NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/UI/UI_LegionBattleTeamOrganiza...

133 lines
3.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UI.Button;
using Image = UnityEngine.UI.Image;
using Toggle = UnityEngine.UI.Toggle;
using ScrollView = PhxhSDK.PhxhScrollView;
using Framework;
using Gameplay;
using Gameplay.Common;
using PhxhSDK;
public class UI_LegionBattleTeamOrganizationController : UIWindow
{
//UI GameObj
///Auto Gen Start///
public Button Button_Back;
public Button Button_back;
public TMP_Text Text_Back;
public Button Button_Home;
public Image Image_Money;
public Button Button_Recharge;
public TMP_Text Text_Target;
public TMP_Text Text_BattleTime;
public RecycleView ScrollView_Team;
public Image Image_TopBg;
public Image Image_TopBgMyTeam;
public Image Image_MyTeamAround;
public TMP_Text Text_TeamTitle;
public TMP_Text Text_TeamLevel;
public Image Image_Mercenary;
public TMP_Text Text_Mercenary;
public Image Image_Part;
public Image Image_SelectBorder;
public Image Image_Unlock;
public Image Image_Sign;
public TMP_Text Text_Level;
public Image Image_PartTypeIcon;
public TMP_Text Text_Cost;
public Image Image_BottomBar;
public TMP_Text Text_Time;
public Button Button_Apply;
public Image Image_Apply;
public Image Image_Stop;
public Button Button_WatchBattleField;
///Auto Gen End///
// deal with input data
public override void PreLoad(object data = null)
{
}
// Use this for initialization
public override void OnInit()
{
//bind UI GameObj
UI_LegionBattleTeamOrganizationBinder.GetComponents(this);
}
//invoke when open window
protected override void OnShowWindow(object data = null)
{
_Refresh();
}
//invoke when reload window
protected override void OnReloadWindow(object data = null)
{
}
//invoke when close window
protected override void OnHideWindow()
{
}
//invoke when destroy
public override void OnRelease()
{
base.OnRelease();
}
protected override void OnUpdate(float dt)
{
base.OnUpdate(dt);
_RefreshBottom();
}
#region Refresh
private void _Refresh()
{
_RefreshTop();
}
private void _RefreshTop()
{
var startTime = CommonUtils.GetScheduleStartDateTime(GLConfig.Inst.data.LegionBattleScheduleIDTeamLock);
var timeStr = startTime.ToString("HH:mm");
Text_BattleTime.text = CommonUtils.GetLocalizeText("legionbattle_start_time",
startTime.Year, startTime.Month, startTime.Day, timeStr);
}
private void _RefreshBottom()
{
var endTimeDate = CommonUtils.GetScheduleStartDateTime(GLConfig.Inst.data.LegionBattleScheduleIDTeam);
var now = CommonUtils.GetCurTime(CommonUtils.E_TimeType.Server);
var timeSpan = endTimeDate - now;
var hour = timeSpan.Hours;
var min = timeSpan.Minutes;
var sec = timeSpan.Seconds;
if (hour > 0)
{
Text_Time.text = CommonUtils.GetLocalizeText("legion_countdown_hour", hour, min, sec);
}
else if(min > 0)
{
Text_Time.text = CommonUtils.GetLocalizeText("legion_countdown_min", min, sec);
}
else
{
Text_Time.text = CommonUtils.GetLocalizeText("legion_countdown_sec", sec);
}
}
#endregion
}