Exemplo n.º 1
0
 protected override void OnLoadFinish()
 {
     base.OnLoadFinish();
     _bind = GetComponent <UIDrawingChatComponent>();
     GameEventCenter.AddListener(GameEvent.UI_NextChat, OnClickNext);
     DialogMgr.InDrawingDialog = true;
 }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
    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();
    }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
 void Awake()
 {
     GameEventCenter.AddListener(GameEvent.OnControllerDeviceChanged, OnDeviceChanged);
 }
Exemplo n.º 6
0
 protected override void Start()
 {
     base.Start();
     GameEventCenter.AddListener(GameEvent.UI_Left, OnClickPrev);
     GameEventCenter.AddListener(GameEvent.UI_Right, OnClickRight);
 }
Exemplo n.º 7
0
 static UiFullView()
 {
     PrevViewTypes = new List <Type>();
     GameEventCenter.AddListener(GameEvent.UI_Back, OnBack);
 }
Exemplo n.º 8
0
 protected override void Start()
 {
     base.Start();
     GameEventCenter.AddListener(GameEvent.UI_Up, OnClickUp);
     GameEventCenter.AddListener(GameEvent.UI_Down, OnClickDown);
 }
Exemplo n.º 9
0
 protected override void Awake()
 {
     base.Awake();
     GameEventCenter.AddListener(GameEvent.OnEnemyDie, OnEnemyDie);
 }
Exemplo n.º 10
0
 // Use this for initialization
 void OnEnable()
 {
     GameEventCenter.AddListener(GameEvent.TestEvent, ShowLog);//register
 }
Exemplo n.º 11
0
 static StageMgr()
 {
     GameEventCenter.AddListener(GameEvent.OnGraze, OnGraze);
     GameEventCenter.AddListener(GameEvent.OnPlayerDead, OnPlayerDead);
 }