提交小游戏项目
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
public class BroadcastCtrl : BaseCtrl
|
||||
{
|
||||
public static BroadcastCtrl Instance { get; private set; }
|
||||
|
||||
private BroadcastModel model;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 575f1d3d71a8445bc8d960a3f33d8bc1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
public class BroadcastModel : BaseModel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2362fee130b6f4067b943f44ba629113
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,221 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using FGUI.ZM_Common_01;
|
||||
using Spine.Unity;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace TowerClimberChronicles
|
||||
{
|
||||
public class BroadcastUI : BaseUI
|
||||
{
|
||||
private BroadcastUICtrl ctrl;
|
||||
private BroadcastModel model;
|
||||
private com_broadcast1 ui;
|
||||
|
||||
public BroadcastUI(BroadcastUICtrl ctrl) : base(ctrl)
|
||||
{
|
||||
uiName = UIConst.BroadcastUI;
|
||||
this.ctrl = ctrl;
|
||||
}
|
||||
|
||||
protected override void SetUIInfo(UIInfo uiInfo)
|
||||
{
|
||||
uiInfo.packageName = "ZM_Common_01";
|
||||
uiInfo.assetName = "com_broadcast1";
|
||||
uiInfo.layerType = UILayerType.Highest;
|
||||
uiInfo.isNeedOpenAnim = false;
|
||||
uiInfo.isNeedCloseAnim = false;
|
||||
uiInfo.isNeedUIMask = false;
|
||||
}
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnBind()
|
||||
{
|
||||
ui = baseUI as com_broadcast1;
|
||||
}
|
||||
|
||||
protected override void OnOpenBefore(object args)
|
||||
{
|
||||
InitView();
|
||||
//ui.y = 241;
|
||||
|
||||
if (UIManager.Instance.IsExistUI(UIConst.RainPlayUI))
|
||||
{
|
||||
|
||||
Settop();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Setbuttom();
|
||||
}
|
||||
// ui.visible = false;
|
||||
// if (Screen.safeArea.y != 0)
|
||||
// {//刘海屏
|
||||
// ui.y += Screen.safeArea.y;
|
||||
// }
|
||||
text_ui = ui.broad_cast_text;
|
||||
|
||||
|
||||
text_ui.btn_broad.SetClick(OpenRecord);
|
||||
|
||||
if (ConfigSystem.GetConfig<SubscribePodcast>() == null) return;
|
||||
config_name_list = SubscribePodcastModel.config_name_list;
|
||||
config_vip_level_list = SubscribePodcastModel.config_vip_level_list;
|
||||
|
||||
GameDispatcher.Instance.AddListener(GameMsg.hideBroadCast, hideEvent);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.showBroadCast, showEvent);
|
||||
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.MainUI_Open,Setbuttom );
|
||||
UICtrlDispatcher.Instance.AddListener(UICtrlMsg.RainPlayUI_Open, Settop);
|
||||
}
|
||||
|
||||
protected override void OnOpen(object args)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisplay(object args)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
private int time_count = 11;
|
||||
private com_broadcast_text1 text_ui;
|
||||
private List<string> config_name_list;
|
||||
private List<string> config_vip_level_list;
|
||||
private bool main_ui_show = true;
|
||||
//初始化页面逻辑
|
||||
|
||||
private Action closeCallback;
|
||||
private void InitView()
|
||||
{
|
||||
HallManager.Instance.UpdateSecondEvent += timeEvent;
|
||||
|
||||
|
||||
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.broad_cast_text.bg_panel, Fx_Type.fx_broad, ref closeCallback);
|
||||
sk.state.SetAnimation(0, "animation", true);
|
||||
ui.broad_cast_text.bg_panel.SetScale(1.45f,1.1f);
|
||||
}
|
||||
|
||||
private void OpenRecord()
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RecordViewUI_Open);
|
||||
}
|
||||
private void hideEvent(object sender = null)
|
||||
{
|
||||
Debug.Log("hide");
|
||||
main_ui_show = false;
|
||||
ui.visible = false;
|
||||
}
|
||||
private void showEvent(object sender = null)
|
||||
{
|
||||
Debug.Log("show");
|
||||
main_ui_show = true;
|
||||
ui.visible = true;
|
||||
}
|
||||
private void Settop(object sender = null)
|
||||
{
|
||||
ui.group_.y = 350;
|
||||
if (Screen.safeArea.y != 0)
|
||||
{//刘海屏
|
||||
ui.group_.y += 68;
|
||||
}
|
||||
}
|
||||
private void Setbuttom(object sender = null)
|
||||
{
|
||||
ui.group_.y = 170;
|
||||
if (Screen.safeArea.y != 0)
|
||||
{//刘海屏
|
||||
ui.group_.y += 68;
|
||||
}
|
||||
}
|
||||
|
||||
#if GAME_RELEASE
|
||||
private const int MaxTime = 5 * 60;
|
||||
#else
|
||||
private const int MaxTime = 10;
|
||||
#endif
|
||||
void timeEvent()
|
||||
{
|
||||
time_count++;
|
||||
|
||||
if (time_count > MaxTime)
|
||||
{
|
||||
time_count = 0;
|
||||
var name_index = Random.Range(0, config_name_list.Count);
|
||||
var money_index = Random.Range(0, config_vip_level_list.Count);
|
||||
Debug.Log(text_ui.cast_text.text);
|
||||
|
||||
string name = config_name_list[name_index];
|
||||
if (name.Length > 8)
|
||||
{
|
||||
name = name[..8] + "..";
|
||||
}
|
||||
string broad_text = String.Format(text_ui.hide_text.text, name,
|
||||
config_vip_level_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
|
||||
text_ui.cast_text.text = broad_text;
|
||||
|
||||
var lv = GetVipLevelFromName(config_vip_level_list[money_index]);
|
||||
text_ui.broad_icon_loader.url = $"ui://LG_Common/vip_{lv}";
|
||||
|
||||
// Tweener tweener = DOTween.To(() => ui.broad.x,
|
||||
// x => ui.broad.x = x, 200, 0.5f);
|
||||
ui.t0.Play();
|
||||
|
||||
DOVirtual.DelayedCall(3.5f, () =>
|
||||
{
|
||||
// Tweener tweener = DOTween.To(() => ui.broad.x,
|
||||
// x => ui.broad.x = x, 1080, 0.5f);
|
||||
ui.t1.Play();
|
||||
});
|
||||
string str = name + "#" + config_vip_level_list[money_index] + "#" + DateTimeManager.Instance.GetCurrDateTime();
|
||||
GameDispatcher.Instance.Dispatch(GameMsg.updateRecordList, str);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int GetVipLevelFromName(string name)
|
||||
{
|
||||
var vip_level = 1;
|
||||
switch (name)
|
||||
{
|
||||
case "Gold":
|
||||
vip_level = 1;
|
||||
break;
|
||||
case "Platinum":
|
||||
vip_level = 2;
|
||||
break;
|
||||
case "Diamond":
|
||||
vip_level = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return vip_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9a4125b4c0c64c94857a7ac85479526
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
namespace TowerClimberChronicles
|
||||
|
||||
{
|
||||
public class BroadcastUICtrl : BaseUICtrl
|
||||
{
|
||||
private BroadcastUI ui;
|
||||
private BroadcastModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.BroadcastUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.BroadcastUI_Close;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
//model = ModuleManager.Instance.GetModel(ModelConst.BroadcastModel) as BroadcastModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new BroadcastUI(this);
|
||||
ui.Open(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
ui = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35a4fff4d50cc4404951bdbed6e43b22
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user