备份CatanBuilding瘦身独立工程
This commit is contained in:
75
Assets/Scripts/UI/Washing/EventWashingBatterylevel.cs
Normal file
75
Assets/Scripts/UI/Washing/EventWashingBatterylevel.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventWashingBatteryLevel : MonoBehaviour
|
||||
{
|
||||
public TMP_Text txt_battery_num;
|
||||
public GameObject[] m_Lowbatterys;
|
||||
public GameObject[] m_Lights;
|
||||
|
||||
public void UpdateToken(int token)
|
||||
{
|
||||
txt_battery_num.text = "x" + token;
|
||||
}
|
||||
public void SetPercentage(float percentage)
|
||||
{
|
||||
int count = m_Lights.Length;
|
||||
float step = 1f / count;
|
||||
int belongStep = (percentage > 0) ? (int)math.floor(percentage / step) + 1 : 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var item = m_Lights[i];
|
||||
if (i < belongStep)
|
||||
{
|
||||
if (item.activeSelf == false)
|
||||
{
|
||||
item.SetActive(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.activeSelf == true)
|
||||
{
|
||||
item.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetEnergyShortage()
|
||||
{
|
||||
int count = m_Lowbatterys.Length;
|
||||
for (int i = 0;i < count; i++)
|
||||
{
|
||||
if (m_Lowbatterys[i].activeSelf == false)
|
||||
{
|
||||
m_Lowbatterys[i].SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (txt_battery_num.gameObject.activeSelf == true)
|
||||
{
|
||||
txt_battery_num.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void SetEnergyEnough()
|
||||
{
|
||||
int count = m_Lowbatterys.Length;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (m_Lowbatterys[i].activeSelf == true)
|
||||
{
|
||||
m_Lowbatterys[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (txt_battery_num.gameObject.activeSelf == false)
|
||||
{
|
||||
txt_battery_num.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingBatterylevel.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingBatterylevel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d35cbf88fd4b694459b01ad1642c545b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
50
Assets/Scripts/UI/Washing/EventWashingConclusion.cs
Normal file
50
Assets/Scripts/UI/Washing/EventWashingConclusion.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using game;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class EventWashingConclusion : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public float displayTime = 1f;
|
||||
|
||||
private float remainingTime;
|
||||
|
||||
private bool isDisplaying = false;
|
||||
|
||||
public void ResetConclusion()
|
||||
{
|
||||
isDisplaying = false;
|
||||
remainingTime = 0f;
|
||||
}
|
||||
|
||||
public void StartConclusion()
|
||||
{
|
||||
if (isDisplaying) return;
|
||||
|
||||
remainingTime = displayTime;
|
||||
this.gameObject.SetActive(true);
|
||||
isDisplaying = true;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
remainingTime -= Time.deltaTime;
|
||||
if (remainingTime <= 0f)
|
||||
{
|
||||
isDisplaying = false;
|
||||
this.gameObject.SetActive(false);
|
||||
FishingYachtAct.Publish<EventWashingStepOverData>(new EventWashingStepOverData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingConclusion.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingConclusion.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55c05183c1232dc4599050021cb5bf17
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
Assets/Scripts/UI/Washing/EventWashingCrosshair.cs
Normal file
36
Assets/Scripts/UI/Washing/EventWashingCrosshair.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EventWashingCrosshair : MonoBehaviour
|
||||
{
|
||||
//[SerializeField] public float displayTime = 0f;
|
||||
|
||||
//private float remainingTime;
|
||||
|
||||
//public void SetAimPosition(Vector3 position)
|
||||
//{
|
||||
// this.gameObject.transform.position = position;
|
||||
// remainingTime = displayTime;
|
||||
// this.gameObject.SetActive(true);
|
||||
//}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//if (remainingTime > 0)
|
||||
//{
|
||||
// remainingTime -= Time.deltaTime;
|
||||
// if (remainingTime <= 0f)
|
||||
// {
|
||||
// this.gameObject.SetActive(false);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingCrosshair.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingCrosshair.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f411fae009c09f4890af547d25a4220
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
41
Assets/Scripts/UI/Washing/EventWashingFinger.cs
Normal file
41
Assets/Scripts/UI/Washing/EventWashingFinger.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Spine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EventWashingFinger : MonoBehaviour
|
||||
{
|
||||
Animator animator;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
animator = this.GetComponent<Animator>();
|
||||
SetAnimationEnabled(false);
|
||||
}
|
||||
|
||||
public void PlayAnimationForPainting()
|
||||
{
|
||||
PlayAnimation("finger_loop_wash");
|
||||
}
|
||||
public void PlayAnimationDefault()
|
||||
{
|
||||
PlayAnimation("finger_loop_wash2");
|
||||
}
|
||||
|
||||
private void PlayAnimation(string name)
|
||||
{
|
||||
SetAnimationEnabled(true);
|
||||
if (animator != null)
|
||||
{
|
||||
animator.Play(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAnimationEnabled(bool enabled)
|
||||
{
|
||||
if (animator != null)
|
||||
{
|
||||
animator.enabled = enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingFinger.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingFinger.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9257fd84d295c3449c8df25f432eb21
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Scripts/UI/Washing/EventWashingGestureFollow.cs
Normal file
35
Assets/Scripts/UI/Washing/EventWashingGestureFollow.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EventWashingGestureFollow : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public float displayTime = 0f;
|
||||
|
||||
private float remainingTime;
|
||||
|
||||
public void SetFollowPosition(Vector3 position, float speed)
|
||||
{
|
||||
float distance = Vector3.Distance(this.gameObject.transform.position, position);
|
||||
float time = distance / speed;
|
||||
this.gameObject.transform.DOKill();
|
||||
this.gameObject.transform.DOMove(position, time).SetEase(Ease.Linear);
|
||||
|
||||
remainingTime = displayTime;
|
||||
if (this.gameObject.activeSelf == false) this.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
remainingTime -= Time.deltaTime;
|
||||
if (remainingTime <= 0f)
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingGestureFollow.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingGestureFollow.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3b3228e910960f4488448cd5d69cbcc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Scripts/UI/Washing/EventWashingInfoPopupPanel.cs
Normal file
31
Assets/Scripts/UI/Washing/EventWashingInfoPopupPanel.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventWashingInfoPopupPanel : BasePanel
|
||||
{
|
||||
private EventWashingDataManager m_DataManager;
|
||||
Button btn_close;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
m_DataManager = GContext.container.Resolve<EventWashingDataManager>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_close.onClick.AddListener(OnBtnCloseClick);
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
btn_close.onClick.RemoveAllListeners();
|
||||
}
|
||||
|
||||
private async void OnBtnCloseClick()
|
||||
{
|
||||
var data = m_DataManager.GetCurrentEventWashing();
|
||||
|
||||
await UIManager.Instance.ShowUI(UITypes.EventWashingPanel);
|
||||
UIManager.Instance.HideUI(m_DataManager.GetCurrentInfoPopupPanel());
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingInfoPopupPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingInfoPopupPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 036081f933efc8c46ad726b73b9b10e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
769
Assets/Scripts/UI/Washing/EventWashingPanel.cs
Normal file
769
Assets/Scripts/UI/Washing/EventWashingPanel.cs
Normal file
@@ -0,0 +1,769 @@
|
||||
using asap.core;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
using cfg;
|
||||
|
||||
public class EventWashingPanel : BasePanel
|
||||
{
|
||||
#region 生命周期
|
||||
protected override void Start()
|
||||
{
|
||||
// 标题
|
||||
InitTitle();
|
||||
|
||||
// 箭头
|
||||
InitArraw();
|
||||
|
||||
// 电池
|
||||
InitBattery();
|
||||
|
||||
// 奖励
|
||||
InitReward();
|
||||
|
||||
// 手指
|
||||
InitFinger();
|
||||
|
||||
//// 瞄准准心
|
||||
//InitAim();
|
||||
// 手势跟踪
|
||||
InitGestureFollow();
|
||||
|
||||
// 关闭按钮
|
||||
btn_close = transform.Find("root/Btn_close").GetComponent<Button>();
|
||||
|
||||
// 所有游戏结束
|
||||
InitGameOver();
|
||||
|
||||
Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
|
||||
{
|
||||
txt_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end", ConvertTools.ConvertTime2(m_DataManager.RemainingTime));
|
||||
}).AddTo(this);
|
||||
|
||||
m_OperationCDTimer = m_MaximumAllowableTimeWithoutOperation;
|
||||
m_State = 0;
|
||||
|
||||
m_IsGuiding = false;
|
||||
|
||||
base.Start();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (m_IsGuiding == true) return;
|
||||
if (Input.anyKey || Input.anyKeyDown)
|
||||
{
|
||||
m_OperationCDTimer = m_MaximumAllowableTimeWithoutOperation;
|
||||
m_State = 0;
|
||||
StopTimeoutHandling();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_OperationCDTimer -= Time.deltaTime;
|
||||
}
|
||||
if (m_OperationCDTimer < 0 && m_State == 0)
|
||||
{
|
||||
m_State = 1;
|
||||
TimeoutHandling();
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (m_DataManager != null && electricityConsumption != null)
|
||||
{
|
||||
electricityConsumption.SetPercentage(m_DataManager.WashingData.Energy);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
btn_introduction.onClick.RemoveAllListeners();
|
||||
btn_preview.onClick.RemoveAllListeners();
|
||||
btn_close.onClick.RemoveAllListeners();
|
||||
btn_left.onClick.RemoveAllListeners();
|
||||
btn_right.onClick.RemoveAllListeners();
|
||||
btn_game_over.onClick.RemoveAllListeners();
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 新手引导
|
||||
bool m_IsGuiding = false;
|
||||
public bool InitGuidance()
|
||||
{
|
||||
m_IsGuiding = GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("EventWashingPanel");
|
||||
if (m_IsGuiding)
|
||||
{
|
||||
m_OperationCDTimer = m_MaximumAllowableTimeWithoutOperation;
|
||||
m_State = 0;
|
||||
StopTimeoutHandling();
|
||||
}
|
||||
return m_IsGuiding;
|
||||
}
|
||||
public void CompleteGuidance()
|
||||
{
|
||||
m_IsGuiding = false;
|
||||
m_OperationCDTimer = m_MaximumAllowableTimeWithoutOperation;
|
||||
m_State = 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据相关
|
||||
private EventWashingDataManager m_DataManager;
|
||||
public void SetDataManager(EventWashingDataManager dataManager)
|
||||
{
|
||||
m_DataManager = dataManager;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 展示模式
|
||||
private void HideAllExceptBtnClose()
|
||||
{
|
||||
// 隐藏标题栏
|
||||
if (obj_title != null)
|
||||
{
|
||||
obj_title.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏奖励栏
|
||||
if (obj_reward != null)
|
||||
{
|
||||
obj_reward.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏箭头栏
|
||||
if (obj_viewpoint != null)
|
||||
{
|
||||
obj_viewpoint.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
//// 隐藏电池栏
|
||||
//if (obj_battery != null)
|
||||
//{
|
||||
// obj_battery.gameObject.SetActive(false);
|
||||
//}
|
||||
|
||||
// 隐藏手指
|
||||
if (finger != null)
|
||||
{
|
||||
finger.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏准心
|
||||
//if (aim != null)
|
||||
//{
|
||||
// aim.gameObject.SetActive(false);
|
||||
//}
|
||||
|
||||
// 隐藏电量消耗
|
||||
if (electricityConsumption != null)
|
||||
{
|
||||
electricityConsumption.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏手势
|
||||
if (gestureFollow != null)
|
||||
{
|
||||
gestureFollow.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏结束语
|
||||
if (conclusion_welldone != null)
|
||||
{
|
||||
conclusion_welldone.gameObject.SetActive(false);
|
||||
}
|
||||
if (conclusion_good != null)
|
||||
{
|
||||
conclusion_good.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏所有游戏结束展示
|
||||
if (obj_game_over != null)
|
||||
{
|
||||
obj_game_over.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 显示关闭按钮
|
||||
if (btn_close != null)
|
||||
{
|
||||
btn_close.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowForRemove()
|
||||
{
|
||||
m_FunctionType = 0;
|
||||
|
||||
m_IsGuiding = false;
|
||||
|
||||
HideAllExceptBtnClose();
|
||||
|
||||
// 显示标题栏
|
||||
SetTitleVisible(true);
|
||||
// 显示奖励
|
||||
SetRewardVisible(true);
|
||||
// 显示电池
|
||||
SetBatteryVisible(true);
|
||||
//// 显示手势跟随
|
||||
//SetGestureFollowVisible(true);
|
||||
//// 显示准心
|
||||
//SetAimVisible(true);
|
||||
// 显示电量消耗
|
||||
SetElectricityConsumptionVisible(true);
|
||||
|
||||
SetTitleInfo();
|
||||
SetBatteryInfo();
|
||||
SetRewardInfo();
|
||||
|
||||
// 手势跟踪
|
||||
InitGestureFollow();
|
||||
SetGestureFollowVisible(false);
|
||||
}
|
||||
|
||||
public void ShowForCleaning()
|
||||
{
|
||||
m_FunctionType = 0;
|
||||
|
||||
m_IsGuiding = false;
|
||||
|
||||
HideAllExceptBtnClose();
|
||||
|
||||
// 显示标题栏
|
||||
SetTitleVisible(true);
|
||||
// 显示奖励
|
||||
SetRewardVisible(true);
|
||||
// 显示电池
|
||||
SetBatteryVisible(true);
|
||||
// 显示手势跟随
|
||||
//SetGestureFollowVisible(true);
|
||||
//// 显示准心
|
||||
//SetAimVisible(true);
|
||||
// 关闭笔刷填充进度
|
||||
ResetBrushChannelCounterFillAndInverse(false, false);
|
||||
// 显示电量消耗
|
||||
SetElectricityConsumptionVisible(true);
|
||||
|
||||
SetTitleInfo();
|
||||
SetBatteryInfo();
|
||||
SetRewardInfo();
|
||||
|
||||
// 手势跟踪
|
||||
InitGestureFollow();
|
||||
SetGestureFollowVisible(false);
|
||||
|
||||
//InitGuidance();
|
||||
}
|
||||
|
||||
public void ShowForPainting()
|
||||
{
|
||||
m_FunctionType = 1;
|
||||
|
||||
m_IsGuiding = false;
|
||||
|
||||
HideAllExceptBtnClose();
|
||||
|
||||
// 显示标题栏
|
||||
SetTitleVisible(true);
|
||||
// 显示奖励
|
||||
SetRewardVisible(true);
|
||||
// 显示电池
|
||||
SetBatteryVisible(true);
|
||||
//// 显示手势跟随
|
||||
//SetGestureFollowVisible(false);
|
||||
//// 显示准心
|
||||
//SetAimVisible(true);
|
||||
// 关闭笔刷填充进度
|
||||
ResetBrushChannelCounterFillAndInverse(false, false);
|
||||
// 显示箭头
|
||||
SetArrowVisible(true);
|
||||
// 显示电量消耗
|
||||
SetElectricityConsumptionVisible(true);
|
||||
|
||||
SetTitleInfo();
|
||||
SetBatteryInfo();
|
||||
SetRewardInfo();
|
||||
|
||||
// 手势跟踪
|
||||
InitGestureFollow();
|
||||
SetGestureFollowVisible(false);
|
||||
|
||||
//InitGuidance();
|
||||
}
|
||||
|
||||
public void ShowForAllGameOver()
|
||||
{
|
||||
m_IsGuiding = false;
|
||||
|
||||
// 隐藏标题栏
|
||||
if (obj_title != null)
|
||||
{
|
||||
obj_title.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏奖励栏
|
||||
if (obj_reward != null)
|
||||
{
|
||||
obj_reward.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏箭头栏
|
||||
if (obj_viewpoint != null)
|
||||
{
|
||||
obj_viewpoint.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏电池栏
|
||||
SetBatteryVisible(false);
|
||||
|
||||
// 隐藏手指
|
||||
if (finger != null)
|
||||
{
|
||||
finger.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏准心
|
||||
//if (aim != null)
|
||||
//{
|
||||
// aim.gameObject.SetActive(false);
|
||||
//}
|
||||
|
||||
//// 隐藏电量消耗
|
||||
//if (electricityConsumption != null)
|
||||
//{
|
||||
// electricityConsumption.gameObject.SetActive(false);
|
||||
//}
|
||||
|
||||
// 隐藏手势
|
||||
if (gestureFollow != null)
|
||||
{
|
||||
gestureFollow.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏结束语
|
||||
if (conclusion_welldone != null)
|
||||
{
|
||||
conclusion_welldone.gameObject.SetActive(false);
|
||||
}
|
||||
if (conclusion_good != null)
|
||||
{
|
||||
conclusion_good.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 显示关闭按钮
|
||||
if (btn_close != null)
|
||||
{
|
||||
btn_close.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 显示游戏结束
|
||||
if (obj_game_over != null)
|
||||
{
|
||||
obj_game_over.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// 隐藏完成所有游戏文字提示
|
||||
if (obj_text_final != null)
|
||||
{
|
||||
obj_text_final.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
SetGestureFollowVisible(false);
|
||||
}
|
||||
|
||||
public void ShowForShipOver()
|
||||
{
|
||||
m_IsGuiding = false;
|
||||
|
||||
// 隐藏标题栏
|
||||
if (obj_title != null)
|
||||
{
|
||||
obj_title.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏奖励栏
|
||||
if (obj_reward != null)
|
||||
{
|
||||
obj_reward.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏箭头栏
|
||||
if (obj_viewpoint != null)
|
||||
{
|
||||
obj_viewpoint.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏电池栏
|
||||
SetBatteryVisible(false);
|
||||
|
||||
// 隐藏手指
|
||||
if (finger != null)
|
||||
{
|
||||
finger.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏准心
|
||||
//if (aim != null)
|
||||
//{
|
||||
// aim.gameObject.SetActive(false);
|
||||
//}
|
||||
|
||||
//// 隐藏电量消耗
|
||||
//if (electricityConsumption != null)
|
||||
//{
|
||||
// electricityConsumption.gameObject.SetActive(false);
|
||||
//}
|
||||
|
||||
// 隐藏手势
|
||||
if (gestureFollow != null)
|
||||
{
|
||||
gestureFollow.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 隐藏结束语
|
||||
if (conclusion_welldone != null)
|
||||
{
|
||||
conclusion_welldone.gameObject.SetActive(false);
|
||||
}
|
||||
if (conclusion_good != null)
|
||||
{
|
||||
conclusion_good.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 显示关闭按钮
|
||||
if (btn_close != null)
|
||||
{
|
||||
btn_close.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 显示游戏结束
|
||||
if (obj_game_over != null)
|
||||
{
|
||||
obj_game_over.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// 隐藏完成所有游戏文字提示
|
||||
if (obj_text_final != null)
|
||||
{
|
||||
obj_text_final.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 手势跟踪
|
||||
InitGestureFollow();
|
||||
SetGestureFollowVisible(false);
|
||||
|
||||
//InitGuidance();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 结束语
|
||||
public EventWashingConclusion conclusion_welldone;
|
||||
public EventWashingConclusion conclusion_good;
|
||||
public void StartConclusion()
|
||||
{
|
||||
if (m_DataManager == null) return;
|
||||
EventWashingStep step = m_DataManager.GetCurrentEventStep();
|
||||
if (step.ShowID == 0)
|
||||
conclusion_welldone.StartConclusion();
|
||||
else if (step.ShowID == 1)
|
||||
conclusion_good.StartConclusion();
|
||||
}
|
||||
public void ResetConclusion(bool isVisible)
|
||||
{
|
||||
//conclusion_welldone.ResetConclusion();
|
||||
//conclusion_welldone.gameObject.SetActive(isVisible);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 当前操作进度
|
||||
public BrushChannelCounterFill brushChannelCounterFillPercentage;
|
||||
public void ResetBrushChannelCounterFillAndInverse(bool inverse, bool enabled = true)
|
||||
{
|
||||
if (brushChannelCounterFillPercentage != null)
|
||||
{
|
||||
brushChannelCounterFillPercentage.Inverse = inverse;
|
||||
brushChannelCounterFillPercentage.enabled = enabled;
|
||||
}
|
||||
}
|
||||
public float GetFillOmitPercentage()
|
||||
{
|
||||
if (brushChannelCounterFillPercentage != null)
|
||||
{
|
||||
return BrushChannelCounterFill.OmitPercentage;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
public void StartCountingFill()
|
||||
{
|
||||
if (brushChannelCounterFillPercentage != null)
|
||||
{
|
||||
brushChannelCounterFillPercentage.StartCounting();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopCountingFill()
|
||||
{
|
||||
if (brushChannelCounterFillPercentage != null)
|
||||
{
|
||||
brushChannelCounterFillPercentage.StopCounting();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetBrushChannelCounterData()
|
||||
{
|
||||
if (brushChannelCounterFillPercentage != null)
|
||||
{
|
||||
brushChannelCounterFillPercentage.ResetData();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 手指
|
||||
public EventWashingFinger finger;
|
||||
private void InitFinger()
|
||||
{
|
||||
|
||||
}
|
||||
public void SetFingerVisible(bool isVisible)
|
||||
{
|
||||
finger.gameObject.SetActive(isVisible);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 手势
|
||||
public EventWashingGestureFollow gestureFollow;
|
||||
public float m_GestureMoveSpeed = 60f;
|
||||
public Transform m_GestureInitTransform = null;
|
||||
protected void InitGestureFollow()
|
||||
{
|
||||
if (m_GestureInitTransform == null) return;
|
||||
gestureFollow.transform.position = m_GestureInitTransform.position;
|
||||
gestureFollow.transform.rotation = m_GestureInitTransform.rotation;
|
||||
gestureFollow.transform.localScale = m_GestureInitTransform.localScale;
|
||||
}
|
||||
public void SetGestureFollowPosition(Vector3 position)
|
||||
{
|
||||
gestureFollow.SetFollowPosition(position, m_GestureMoveSpeed);
|
||||
}
|
||||
public void SetGestureFollowVisible(bool isVisible)
|
||||
{
|
||||
gestureFollow.gameObject.SetActive(isVisible);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 标题
|
||||
GameObject obj_title;
|
||||
TMP_Text txt_title_name;
|
||||
TMP_Text txt_time;
|
||||
Button btn_introduction;
|
||||
Button btn_preview;
|
||||
|
||||
private void InitTitle()
|
||||
{
|
||||
// 标题
|
||||
obj_title = transform.Find("root/title").gameObject;
|
||||
txt_title_name = transform.Find("root/title/Txt_titleName").GetComponent<TMP_Text>();
|
||||
txt_time = transform.Find("root/title/Txt_time").GetComponent<TMP_Text>();
|
||||
btn_introduction = transform.Find("root/title/Btn_questionmark").GetComponent<Button>();
|
||||
btn_introduction.onClick.AddListener(OnBtnQuestionmark);
|
||||
btn_preview = transform.Find("root/title/Btn_preview").GetComponent<Button>();
|
||||
//btn_preview.onClick.AddListener(OnBtnPreview);
|
||||
}
|
||||
public void SetTitleVisible(bool isVisible)
|
||||
{
|
||||
obj_title.SetActive(isVisible);
|
||||
}
|
||||
private async void OnBtnQuestionmark()
|
||||
{
|
||||
await UIManager.Instance.ShowUI(m_DataManager.GetCurrentInfoPopupPanel());
|
||||
UIManager.Instance.HideUI(UITypes.EventWashingPanel);
|
||||
}
|
||||
public void SetBtnPreviewClickListener(UnityAction listener)
|
||||
{
|
||||
btn_preview.onClick.RemoveAllListeners();
|
||||
if (listener != null)
|
||||
btn_preview.onClick.AddListener(listener);
|
||||
}
|
||||
|
||||
public void SetTitleInfo()
|
||||
{
|
||||
txt_title_name.text = LocalizationMgr.GetFormatTextValue("UI_EventWashingPanel_1", m_DataManager.GetShipName());
|
||||
|
||||
txt_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end", ConvertTools.ConvertTime2(m_DataManager.RemainingTime));
|
||||
//Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
|
||||
//{
|
||||
// txt_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end", ConvertTools.ConvertTime2(m_DataManager.RemainingTime));
|
||||
//}).AddTo(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 奖励
|
||||
// 奖励
|
||||
GameObject obj_reward;
|
||||
Image img_icon_tool;
|
||||
Image img_reward_progress;
|
||||
TMP_Text txt_step_name;
|
||||
public RewardItemNew rewardItem;
|
||||
private void InitReward()
|
||||
{
|
||||
// 奖励
|
||||
obj_reward = transform.Find("root/reward").gameObject;
|
||||
img_icon_tool = transform.Find("root/reward/bg_reward/icon_tool").GetComponent<Image>();
|
||||
img_reward_progress = transform.Find("root/reward/bg_reward/bg_bar/Img_bar").GetComponent<Image>();
|
||||
txt_step_name = transform.Find("root/reward/bg_reward/Txt_stepName").GetComponent<TMP_Text>();
|
||||
|
||||
// 奖励进度
|
||||
img_reward_progress.fillAmount = 0f;
|
||||
}
|
||||
|
||||
public void SetRewardVisible(bool isVisible)
|
||||
{
|
||||
obj_reward.SetActive(isVisible);
|
||||
}
|
||||
|
||||
public void UpdateSingleProgress(float ratio)
|
||||
{
|
||||
img_reward_progress.fillAmount = ratio;
|
||||
}
|
||||
|
||||
public void SetRewardInfo()
|
||||
{
|
||||
EventWashingStep washingStep = m_DataManager.GetCurrentEventStep();
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(img_icon_tool, washingStep.Icon, BasePanel.PanelName);
|
||||
|
||||
txt_step_name.text = LocalizationMgr.GetText(washingStep.Name_l10n_key);
|
||||
|
||||
if (string.IsNullOrEmpty(washingStep.GiftIcon))
|
||||
{
|
||||
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(washingStep.DropID, 0);
|
||||
rewardItem.SetRewardPopupData(itemData);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItem.SetDropIcon(washingStep.GiftIcon, washingStep.DropID);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 箭头
|
||||
// 箭头
|
||||
GameObject obj_viewpoint;
|
||||
Button btn_left;
|
||||
Button btn_right;
|
||||
|
||||
private void InitArraw()
|
||||
{
|
||||
// 箭头
|
||||
obj_viewpoint = transform.Find("root/viewpoint").gameObject;
|
||||
btn_left = transform.Find("root/viewpoint/left").GetComponent<Button>();
|
||||
btn_right = transform.Find("root/viewpoint/right").GetComponent<Button>();
|
||||
}
|
||||
// 设置箭头显示状态
|
||||
public void SetArrowVisible(bool isVisible)
|
||||
{
|
||||
obj_viewpoint.SetActive(isVisible);
|
||||
}
|
||||
|
||||
public void SetBtnArrayClickListener(UnityAction left, UnityAction right)
|
||||
{
|
||||
btn_left.onClick.RemoveAllListeners();
|
||||
if (left != null)
|
||||
btn_left.onClick.AddListener(left);
|
||||
|
||||
btn_right.onClick.RemoveAllListeners();
|
||||
if (right != null)
|
||||
btn_right.onClick.AddListener(right);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 电池
|
||||
public EventWashingBatteryLevel electricityConsumption; // 电量消耗
|
||||
private void InitBattery()
|
||||
{
|
||||
|
||||
}
|
||||
// 设置电池显示状态
|
||||
public void SetBatteryVisible(bool isVisible)
|
||||
{
|
||||
electricityConsumption.gameObject.SetActive(isVisible);
|
||||
}
|
||||
// 设置电量消耗显示状态
|
||||
public void SetElectricityConsumptionVisible(bool isVisible)
|
||||
{
|
||||
//electricityConsumption.gameObject.SetActive(isVisible);
|
||||
}
|
||||
public void SetBatteryInfo()
|
||||
{
|
||||
electricityConsumption.UpdateToken(m_DataManager.GetToken());
|
||||
}
|
||||
public void SetEnergyShortage()
|
||||
{
|
||||
electricityConsumption.SetEnergyShortage();
|
||||
}
|
||||
public void SetEnergyEnough()
|
||||
{
|
||||
electricityConsumption.SetEnergyEnough();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 关闭按钮
|
||||
// 关闭按钮
|
||||
Button btn_close;
|
||||
public void SetBtnCloseClickListener(UnityAction listener)
|
||||
{
|
||||
btn_close.onClick.RemoveAllListeners();
|
||||
btn_game_over.onClick.RemoveAllListeners();
|
||||
if (listener != null)
|
||||
{
|
||||
btn_close.onClick.AddListener(listener);
|
||||
btn_game_over.onClick.AddListener(listener);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 长时间不操作检测
|
||||
[Tooltip("最长允许无操作时间")]
|
||||
[SerializeField]
|
||||
private float m_MaximumAllowableTimeWithoutOperation = 5f;
|
||||
private float m_OperationCDTimer;
|
||||
private int m_State = 0;
|
||||
private int m_FunctionType = 0;
|
||||
|
||||
private void TimeoutHandling()
|
||||
{
|
||||
if (finger == null) return;
|
||||
SetFingerVisible(true);
|
||||
if (m_FunctionType == 1) finger.PlayAnimationForPainting();
|
||||
else finger.PlayAnimationDefault();
|
||||
}
|
||||
private void StopTimeoutHandling()
|
||||
{
|
||||
if (finger == null) return;
|
||||
finger.SetAnimationEnabled(false);
|
||||
SetFingerVisible(false);
|
||||
}
|
||||
|
||||
public void ContinuousOperation()
|
||||
{
|
||||
m_OperationCDTimer = m_MaximumAllowableTimeWithoutOperation;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 游戏结束
|
||||
Button btn_game_over;
|
||||
GameObject obj_game_over;
|
||||
GameObject obj_text_final;
|
||||
private void InitGameOver()
|
||||
{
|
||||
obj_game_over = transform.Find("root/Obj_finished").gameObject;
|
||||
btn_game_over = transform.Find("root/Obj_finished/Btn_confirm/btn_green").GetComponent<Button>();
|
||||
obj_text_final = transform.Find("root/Obj_finished/text_final").gameObject;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
11
Assets/Scripts/UI/Washing/EventWashingPanel.cs.meta
Normal file
11
Assets/Scripts/UI/Washing/EventWashingPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fa9d3e3c9055c84886bfe93ac368261
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user