protected override void OnLoadFinish() { base.OnLoadFinish(); _bind = GetComponent <UIDrawingChatComponent>(); GameEventCenter.AddListener(GameEvent.UI_NextChat, OnClickNext); DialogMgr.InDrawingDialog = true; }
protected virtual void Start() { var btns = GetComponentsInChildren <ISelectAble>(true); var bSelectFirst = false; //根据父UI节点类型,拿到默认选项 var parentUi = GetComponentInParent <UiInstance>(); int defaultIdx = 0; if (parentUi != null) { _parentUIType = parentUi.GetType(); SelectStatus.TryGetValue(_parentUIType, out defaultIdx); } //初始化 for (int i = 0; i < btns.Length; i++) { var btn = btns[i]; btn.SetSelect(false); ItemList.Add(btn); } //自动选中 for (int i = 0; i < btns.Length; i++) { var btn = btns[i]; if (!bSelectFirst) { if (btn.IsEnable && i == defaultIdx) { btn.SetSelect(true, true); CurrSelectIdx = i; bSelectFirst = true; } } else { btn.SetSelect(false); } } OnInitOver?.Invoke(); GameEventCenter.AddListener(GameEvent.UI_Sure, OnClickSure); }
protected override void OnLoadFinish() { base.OnLoadFinish(); _bind = GetComponent <UIBattleComponent>(); Instance = this; _bind.LeftTimeRoot.gameObject.SetActiveSafe(false); _defaultLeftTimePos = _bind.LeftTimeRoot.anchoredPosition; _defaultCardNamePos = _bind.CardNameRoot.anchoredPosition; _defaultCardBonusPos = _bind.CardBonusRoot.anchoredPosition; RefreshDifficult(); RefreshLifeCount(); GameEventCenter.AddListener(GameEvent.LifeCountChanged, RefreshLifeCount); InitDebug(); }
public void Init(Boss enemy, int maxHp) { Master = enemy; var deploy = Master.Deploy; _cardList.Clear(); int perCardHp = maxHp / deploy.BossCard.Length; for (int i = 0; i < deploy.BossCard.Length; i++) { var strClass = deploy.BossCard[i]; if (!string.IsNullOrEmpty(strClass)) { var card = Common.CreateInstance(strClass) as BossCardBase; if (card != null) { card.Init(Master, perCardHp); _cardList.Add(card); } } } if (_cardList.Count == 1) { _cardList[0].Phase = EBossCardPhase.Single; } else { for (int i = 0; i < _cardList.Count; i++) { _cardList[i].Phase = i % 2 == 0 ? EBossCardPhase.One : EBossCardPhase.Two; } } GameEventCenter.AddListener(GameEvent.OnPlayerDead, OnPlayerDead); }
void Awake() { GameEventCenter.AddListener(GameEvent.OnControllerDeviceChanged, OnDeviceChanged); }
protected override void Start() { base.Start(); GameEventCenter.AddListener(GameEvent.UI_Left, OnClickPrev); GameEventCenter.AddListener(GameEvent.UI_Right, OnClickRight); }
static UiFullView() { PrevViewTypes = new List <Type>(); GameEventCenter.AddListener(GameEvent.UI_Back, OnBack); }
protected override void Start() { base.Start(); GameEventCenter.AddListener(GameEvent.UI_Up, OnClickUp); GameEventCenter.AddListener(GameEvent.UI_Down, OnClickDown); }
protected override void Awake() { base.Awake(); GameEventCenter.AddListener(GameEvent.OnEnemyDie, OnEnemyDie); }
// Use this for initialization void OnEnable() { GameEventCenter.AddListener(GameEvent.TestEvent, ShowLog);//register }
static StageMgr() { GameEventCenter.AddListener(GameEvent.OnGraze, OnGraze); GameEventCenter.AddListener(GameEvent.OnPlayerDead, OnPlayerDead); }