141 lines
3.8 KiB
C#
141 lines
3.8 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.Item;
|
|||
|
using System.Collections.Generic;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.GlobeDefine;
|
|||
|
|
|||
|
public class GuanningAreaLogic : UIControllerBase<GuanningAreaLogic>
|
|||
|
{
|
|||
|
void Start()
|
|||
|
{
|
|||
|
OnBtnHelp();
|
|||
|
}
|
|||
|
|
|||
|
void OnEnable ()
|
|||
|
{
|
|||
|
SetInstance(this);
|
|||
|
|
|||
|
for (int i = 0; i < _AreaProcess1.Length; ++i)
|
|||
|
{
|
|||
|
_AreaProcess1[i].value = 0.5f;
|
|||
|
_AreaProcess2[i].value = 0.5f;
|
|||
|
}
|
|||
|
|
|||
|
GCGame.Utils.HideMainTopRightUI(false);
|
|||
|
ShowMatchTip();
|
|||
|
_TimeLabel.text = "-";
|
|||
|
}
|
|||
|
|
|||
|
void OnDisable()
|
|||
|
{
|
|||
|
SetInstance(null);
|
|||
|
|
|||
|
GCGame.Utils.ShowMainTopRightUI();
|
|||
|
}
|
|||
|
|
|||
|
public void CloseWindow()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.GuanningAreaRoot);
|
|||
|
}
|
|||
|
|
|||
|
public void ShowPanel()
|
|||
|
{
|
|||
|
_ShowPanel.SetActive(true);
|
|||
|
}
|
|||
|
|
|||
|
public void HidePanel()
|
|||
|
{
|
|||
|
_ShowPanel.SetActive(false);
|
|||
|
}
|
|||
|
|
|||
|
#region
|
|||
|
|
|||
|
public const int _AREA_PROCESS_MAX = 60;
|
|||
|
|
|||
|
public GameObject _ShowPanel;
|
|||
|
public Slider[] _AreaProcess1;
|
|||
|
public Slider[] _AreaProcess2;
|
|||
|
public GameObject _MatchTip;
|
|||
|
public Vector3[] _GotoPos;
|
|||
|
|
|||
|
public void UpdateAreaProcess(GC_BATTLE_FIELD_ZONE_UPDATE packet)
|
|||
|
{
|
|||
|
GCGame.Utils.HideMainTopRightUI(false);
|
|||
|
for (int i = 0; i < packet.progsCount; ++i)
|
|||
|
{
|
|||
|
_AreaProcess1[i].value = (float)packet.GetProgs(i).curValueList[0] / _AREA_PROCESS_MAX;
|
|||
|
_AreaProcess2[i].value = (float)packet.GetProgs(i).curValueList[1] / _AREA_PROCESS_MAX;
|
|||
|
}
|
|||
|
_MatchTip.SetActive(false);
|
|||
|
UpdateTime(packet.Lefttime);
|
|||
|
}
|
|||
|
|
|||
|
public void OnBtnShowScore()
|
|||
|
{
|
|||
|
CG_USER_ASK_SCORE_BOARD packet = (CG_USER_ASK_SCORE_BOARD)PacketDistributed.CreatePacket(MessageID.PACKET_CG_USER_ASK_SCORE_BOARD);
|
|||
|
packet.Ask = 1;
|
|||
|
packet.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
public void ShowMatchTip()
|
|||
|
{
|
|||
|
StartCoroutine(ShowMatchTipDelay());
|
|||
|
}
|
|||
|
|
|||
|
private IEnumerator ShowMatchTipDelay()
|
|||
|
{
|
|||
|
while (Singleton<ObjManager>.GetInstance().MainPlayer == null)
|
|||
|
yield return null;
|
|||
|
_MatchTip.SetActive(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Force != 6
|
|||
|
&& GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Force != 7);
|
|||
|
}
|
|||
|
|
|||
|
public void OnBtnHelp()
|
|||
|
{
|
|||
|
MessageHelpLogic.ShowHelpMessage(35);
|
|||
|
}
|
|||
|
|
|||
|
public void OnBtnGoto(int idx)
|
|||
|
{
|
|||
|
// 自动寻路
|
|||
|
AutoSearchPoint point = new AutoSearchPoint(GameManager.gameManager.RunningScene, _GotoPos[idx].x, _GotoPos[idx].z, -1, AutoSearchPoint.ChangeMap_Type.WORLDMAP, Games.GlobeDefine.GlobeVar.INVALID_GUID);
|
|||
|
if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
|
|||
|
{
|
|||
|
GameManager.gameManager.AutoSearch.BuildPath(point);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnBtnExit()
|
|||
|
{
|
|||
|
Tab_SceneClass tabSceneClass = TableManager.GetSceneClassByID(Games.GlobeDefine.GlobeVar.MAIN_SCNENE_ID, 0);
|
|||
|
if (null == tabSceneClass)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
// 传送时,停止主角移动并停止自动寻路
|
|||
|
var mainPlayer = ObjManager.Instance.MainPlayer;
|
|||
|
if (mainPlayer != null)
|
|||
|
mainPlayer.StopMove();
|
|||
|
GameManager.gameManager.AutoSearch.Stop();
|
|||
|
SceneData.RequestChangeScene((int)CG_REQ_CHANGE_SCENE.CHANGETYPE.WORLDMAP, 0, Games.GlobeDefine.GlobeVar.MAIN_SCNENE_ID, -1, (int)tabSceneClass.SafeX, (int)tabSceneClass.SafeZ);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region time
|
|||
|
|
|||
|
public Text _TimeLabel;
|
|||
|
|
|||
|
public void UpdateTime(uint leftTime)
|
|||
|
{
|
|||
|
var timeSpan = System.TimeSpan.FromSeconds(leftTime);
|
|||
|
string timeStr = string.Format("{0:mm:ss}", timeSpan).Substring(3);
|
|||
|
_TimeLabel.text = timeStr;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|