Esempio n. 1
0
    protected override void OnShown()
    {
        _components.RemoveChildrenToPool();
        {
            AccesoryView obj = (AccesoryView)_components.AddItemFromPool();

            obj.setUneuip(nowComponent);

            obj.onClick.Set(delegate() {
                _components.ClearSelection();
                obj.selected = true;
                choose       = -1;
                changeDetailView();
            });
        }
        int idx = 0;

        foreach (TowerComponent tc in PlayerData.getInstance().bagComponents)
        {
            AccesoryView obj = (AccesoryView)_components.AddItemFromPool();
            obj.updateView(tc);
            int ii = idx;



            obj.onClick.Set(delegate() {
                _components.ClearSelection();
                obj.selected = true;
                choose       = ii;
                changeDetailView();
            });
            idx++;
        }
    }
Esempio n. 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="_comName"></param>
    /// <param name="_numItems">这个值不为空,会执行一次 numItems</param>
    /// <param name="_isVirtual">false 不复用列表</param>
    /// <param name="_selectedIndex">指定显示的下标,滚动显示并且至底层</param>
    public void SetFairyListNumItems(string _comName, int _numItems, bool _isVirtual, int _selectedIndex)
    {
        GObject tempCom = GetFairyObject(_comName);

        if (tempCom == null)
        {
            LogError("_asCom value nil");
            return;
        }

        GList tempList = tempCom.asList;

        if (tempList == null)
        {
            LogError("tempList value nil");
            return;
        }

        if (_isVirtual)
        {
            tempList.SetVirtual();
        }

        tempList.numItems = _numItems;
        if (_numItems > 0 && _selectedIndex != -1)
        {
            tempList.AddSelection(_selectedIndex, true);
        }
        else
        {
            tempList.ClearSelection();
        }
    }
Esempio n. 3
0
    public void SetFairyItemSelected(string _comName, int _selectedIndex)
    {
        GObject tempCom = GetFairyObject(_comName);

        if (tempCom == null)
        {
            LogError("_asCom value nil");
            return;
        }

        GList tempList = tempCom.asList;

        if (tempList == null)
        {
            LogError("tempList value nil");
            return;
        }

        if (_selectedIndex != -1)
        {
            tempList.AddSelection(_selectedIndex, true);
        }
        else
        {
            tempList.ClearSelection();
        }
    }
Esempio n. 4
0
    void changeHeroDetail()
    {
        choosedHeroIdx = (_hero_list.GetFirstChildInView() + 1) % _hero_list.numItems;
        _info.text     = GameStaticData.getInstance().heroes [choosedHeroIdx].name;
        _desp.text     = GameStaticData.getInstance().heroes [choosedHeroIdx].desp;

        _hero_list.ClearSelection();
        _hero_list.GetChildAt(1).asButton.selected = true;;
    }
Esempio n. 5
0
 protected override void OnShown()
 {
     _components.RemoveChildrenToPool();
     //_components.numItems = 3;
     for (int i = 0; i < componentsToSell.Count; i++)
     {
         AccesoryView obj = (AccesoryView)_components.AddItemFromPool();
         obj.updateView(componentsToSell[i]);
         int idx = i;
         obj.onClick.Set(delegate() {
             _components.ClearSelection();
             obj.selected    = true;
             componentChoice = idx;
             changeDetailView();
         });
     }
 }
Esempio n. 6
0
    protected override void OnShown()
    {
        _new_item_list.ClearSelection();
        _new_item_list.RemoveChildrenToPool();


        for (int i = 0; i < items.Count; i++)
        {
            NewItem item = (NewItem)_new_item_list.AddItemFromPool();


            item.init(items[i]);
            item.onClick.Add(delegate() {
                if (_new_item_list.selectedIndex != -1)
                {
                    _confirm.visible = true;
                }
                if (PlayerData.getInstance().guideStage == 10)
                {
                    GuideManager.getInstance().showGuideConfirmChooseItem();
                    PlayerData.getInstance().guideStage = 11;
                }
            });
            item.GetChild("detail").onTouchBegin.Add(delegate() {
                //Debug.Log("Show Detail");
            });
        }


        _confirm.visible = false;

        if (PlayerData.getInstance().guideStage == 4)
        {
            GuideManager.getInstance().showGuideChooseItem();
            PlayerData.getInstance().guideStage = 10;
        }
    }
Esempio n. 7
0
    void changeView(int stageIndex)
    {
        EncounterStage stage = null;

        converters.Clear();
        if (!encounter.stages.TryGetValue(stageIndex, out stage))
        {
            return;
        }
        if (stage.extra == "monster")
        {
            EnemyCombo ec = GameStaticData.getInstance().getEnemyWithValue(5);
            GameManager.getInstance().chaseByEnemy(ec);
        }
        else if (stage.extra == "toturial_monster")
        {
            EnemyCombo ec = GameStaticData.getInstance().getSpecifiedEnemy("toturial");
            GameManager.getInstance().chaseByEnemy(ec);
        }

        if (stage.stageType == eStageType.FINISH)
        {
            getRes(stage.res);
            return;
        }
        else if (stage.stageType == eStageType.BATTLE)
        {
            EncounterBattleInfo battleInfo = stage.battleInfo;

            PlayerData.getInstance().initBattle(encounter.eId, stageIndex, battleInfo);
            GameManager.getInstance().enterBattle();
            this.Hide();
            return;
        }
        else if (stage.stageType == eStageType.CHECK)
        {
            Debug.Log("check");

            int nextStage = -1;
            for (int i = 0; i < stage.converts.Count - 1; i++)
            {
                EncounterConvert convert    = stage.converts [i];
                bool             canConvert = checkConditions(convert.checks);
                if (canConvert)
                {
                    nextStage = convert.nextStageIdx;
                    break;
                }
            }
            if (nextStage == -1)
            {
                nextStage = stage.converts [stage.converts.Count - 1].nextStageIdx;
            }
            if (nextStage != -1)
            {
                stageIndex = nextStage;
                changeView(stageIndex);
            }
            else
            {
                Debug.Log("error");
                panelHide();
            }
        }
        else if (stage.stageType == eStageType.RANDOM)
        {
            int randomInt = Random.Range(0, 99);
            int nextStage = -1;
            for (int i = 0; i < stage.converts.Count - 1; i++)
            {
                EncounterConvert convert    = stage.converts [i];
                bool             canConvert = checkConditions(convert.checks, randomInt);
                if (canConvert)
                {
                    nextStage = convert.nextStageIdx;
                    break;
                }
            }
            if (nextStage == -1)
            {
                nextStage = stage.converts [stage.converts.Count - 1].nextStageIdx;
            }
            if (nextStage != -1)
            {
                stageIndex = nextStage;
                changeView(stageIndex);
            }
            else
            {
                Debug.Log("error");
                panelHide();
            }
        }
        else
        {
            _text.text = stage.desp;
            int idx = 0;


            _branches.ClearSelection();
            _branches.RemoveChildrenToPool();


//			for(int i=0;i<items.Count;i++)
//			{
//				NewItem item = (NewItem)_new_item_list.AddItemFromPool();
//				item.init (items[i]);
//				item.onClick.Add (delegate() {
//					if(_new_item_list.selectedIndex!=-1){
//						_confirm.visible = true;
//					}
//					if (PlayerData.getInstance ().guideStage == 10) {
//						GuideManager.getInstance ().showGuideConfirmChooseItem ();
//						PlayerData.getInstance ().guideStage = 11;
//					}
//				});
//				item.GetChild ("detail").onTouchBegin.Add (delegate() {
//					//Debug.Log("Show Detail");
//				});
//			}

            int numOfBranch = 0;


            for (int i = 0; i < stage.converts.Count; i++)
            {
                EncounterConvert convert = stage.converts [i];
                bool             canShow = checkConditions(convert.checks);
                //EncounterConvert convert = stage.converts [i];
                if (canShow)
                {
                    SelectionBranch item = (SelectionBranch)_branches.AddItemFromPool().asButton;
                    item.init(numOfBranch++, convert.choiceDesp);
                    item.visible = true;
                    converters.Add(convert);
                }
            }
            _branches.ResizeToFit(numOfBranch);

//			for (int i = 0; i < stage.converts.Count; i++) {
//				EncounterConvert convert = stage.converts [i];
//				bool canShow = checkConditions (convert.checks);
//				//EncounterConvert convert = stage.converts [i];
//				if (canShow) {
//
//					SelectionBranch item = (SelectionBranch)_branches.GetChildAt (i).asButton;
//					item.idx = numOfBranch ++ ;
//
//					_branches.GetChildAt(idx).asButton.title = convert.choiceDesp;
//					_branches.GetChildAt(idx).visible = true;
//					converters.Add (convert);
//					idx++;
//
//
//				}
//			}
//			for (int i = idx; i < MAX_BRANCH_NUM; i++) {
//				_branches.GetChildAt(i).asButton.title ="";
//				_branches.GetChildAt(i).visible = false;
//			}

            _loader.url = "Explore/default_bg";
        }

        if (PlayerData.getInstance().guideStage == 2)
        {
            PlayerData.getInstance().guideStage = 3;
            GuideManager.getInstance().showGuideChooseBranch();
        }
        else if (PlayerData.getInstance().guideStage == 3)
        {
            PlayerData.getInstance().guideStage = 4;
            GuideManager.getInstance().showGuideChooseBranch();
        }
        else if (PlayerData.getInstance().guideStage == 4)
        {
            GuideManager.getInstance().hideGuide();
        }
    }