Example #1
0
    void OnLeftArrowClickHandler()
    {
        if (selectIdx > 0)
        {
            selectIdx--;
            selectGeneralIdx = (int)generalsList.GetListItem(selectIdx).GetItemData();

            OnChangeGeneralInfo();
        }
    }
    public void Show()
    {
        if (targetList.GetCount() == 0)
        {
            return;
        }

        if (targetList.GetCount() == 1)
        {
            targetData = (TargetData)targetList.GetListItem(0).GetItemData();
            ChangeToTargetCommands();
            targetList.Clear();
            return;
        }

        state = 0;

        if (menuAnim == null)
        {
            menuAnim = GetComponent <MenuDisplayAnim>();
        }

        menuAnim.SetAnim(MenuDisplayAnim.AnimType.InsertFromRight);

        gameObject.SetActive(true);
    }
Example #3
0
    void OnSelectGeneral()
    {
        if (state != 0)
        {
            return;
        }

        int         count = objsList.GetCount();
        int         gIdx  = (int)generalsInfoList.GetSelectItem().GetItemData();
        GeneralInfo gInfo = Informations.Instance.GetGeneralInfo(gIdx);

        for (int i = 0; i < count; i++)
        {
            ListItem item = objsList.GetListItem(i);

            CityObjectsData cityData = (CityObjectsData)item.GetItemData();
            int             data     = cityData.code;
            if (data == -1)
            {
                continue;
            }

            int  code = data & 0xFFFF;
            int  type = data >> 16;
            bool flag = true;

            switch (type)
            {
            case 1:
                if (gInfo.equipment == code)
                {
                    flag = false;
                }
                break;

            case 2:
                if ((gInfo.arms & code) != 0)
                {
                    flag = false;
                }
                break;

            case 3:
                if ((gInfo.formation & code) != 0)
                {
                    flag = false;
                }
                break;
            }

            item.SetSelectEnable(flag);
        }

        if (count > 0 && ((CityObjectsData)objsList.GetListItem(count - 1).GetItemData()).code == -1)
        {
            if (gInfo.equipment == -1)
            {
                objsList.DeleteItem(count - 1);
            }
        }
        else
        {
            if (gInfo.equipment != -1)
            {
                ListItem li = objsList.AddItem(ZhongWen.Instance.xiexia);

                CityObjectsData data = new CityObjectsData(0, -1);
                li.SetItemData(data);
            }
        }
    }