Пример #1
0
    public void OnMonsterClick_Selected(int id, MonsterRowView.TableSide tableSide)
    {
        MonsterRowView mv       = null;
        MonsterRowView mvMirror = null; // corresponding monster on the other side

        if (tableSide == MonsterRowView.TableSide.RIGHT)
        {
            mv = view.right_list_root.GetChild(id).GetComponent <MonsterRowView>();
            this.rightSelectedMonster = null;
            // ...also unlock left side monster
            mvMirror = view.left_list_root.GetChild(id).GetComponent <MonsterRowView>();
            mvMirror.ActivateView();
        }
        else if (tableSide == MonsterRowView.TableSide.LEFT)
        {
            mv = view.left_list_root.GetChild(id).GetComponent <MonsterRowView>();
            this.leftSelectedMonster = null;
            // TODO...also unlock right side monster
            mvMirror = view.right_list_root.GetChild(id).GetComponent <MonsterRowView>();
            mvMirror.ActivateView();
        }

        if (mv != null)
        {
            mv.DeselectView();
            SetDelegateToNotSelected(mv);
        }

        RefreshBreedingButton();
    }
Пример #2
0
    public void OnMonsterClick_NotSelected(int id, MonsterRowView.TableSide tableSide)
    {
        MonsterRowView mv       = null;
        MonsterRowView mvMirror = null; // corresponding monster on the other side

        //Debug.Log("Mediator monster button clicked with id " + id + "  and side "  +tableSide.ToString());
        if (tableSide == MonsterRowView.TableSide.RIGHT)
        {
            mv = view.right_list_root.GetChild(id).GetComponent <MonsterRowView>();

            // if a current selection on the right
            if (this.rightSelectedMonster != null)
            {
                this.rightSelectedMonster.DeselectView();
                // set delegates to not selected
                SetDelegateToNotSelected(this.rightSelectedMonster);

                // ...also unlock left side monster
                mvMirror = view.left_list_root.GetChild(this.rightSelectedMonster.id).GetComponent <MonsterRowView>();
                mvMirror.ActivateView();
            }

            // update current selection value
            this.rightSelectedMonster = mv;

            // ...also lock left side monster
            mvMirror = view.left_list_root.GetChild(id).GetComponent <MonsterRowView>();
            mvMirror.DeactivateView();
        }
        else if (tableSide == MonsterRowView.TableSide.LEFT)
        {
            mv = view.left_list_root.GetChild(id).GetComponent <MonsterRowView>();

            if (this.leftSelectedMonster != null)
            {
                this.leftSelectedMonster.DeselectView();
                // set delegates to not selected
                SetDelegateToNotSelected(this.leftSelectedMonster);

                // ...also unlock right side monster
                mvMirror = view.right_list_root.GetChild(this.leftSelectedMonster.id).GetComponent <MonsterRowView>();
                mvMirror.ActivateView();
            }
            this.leftSelectedMonster = mv;
            //  ...also lock right side monster
            mvMirror = view.right_list_root.GetChild(id).GetComponent <MonsterRowView>();
            mvMirror.DeactivateView();
        }
        if (mv != null)
        {
            mv.SelectView();
            SetDelegateToSelected(mv);
        }

        RefreshBreedingButton();
    }