Beispiel #1
0
    override protected void OnShown()
    {
        GList list = this.contentPane.GetChild("n6").asList;

        list.RemoveChildrenToPool();

        for (int i = 0; i < 6; i++)
        {
            GButton item = list.AddItemFromPool().asButton;
            item.title = "" + i;
            item.icon  = UIPackage.GetItemURL("Demo", "r4");
        }
    }
Beispiel #2
0
        void addRoomItem(Network.Msg.Room room)
        {
            GComponent item = list.AddItemFromPool().asCom;

            item.GetChild("id").text      = room.id + "";
            item.GetChild("score").text   = scores[room.score];
            item.GetChild("pay").text     = room.pay == 0 ? "老板" : "AA";
            item.GetChild("count").text   = room.current + "/" + room.count + "";
            item.GetChild("players").text = room.players + "";
            item.GetChild("btnInvite").asButton.onClick.Add(onInviteClick);

            list.AddChild(item);
        }
Beispiel #3
0
        public void newtipsData(string iconurl, string nametext, string datacount)
        {
            GComponent gComponent = gList.AddItemFromPool().asCom;

            gComponent.visible = true;
            gComponent.alpha   = 1;
            TipsData tipsData = new TipsData(gComponent, gComponent.GetChild("n0").asLoader, gComponent.GetChild("n1").asTextField, gComponent.GetChild("n2").asTextField);

            gList.ResizeToFit(gList.numChildren);
            gList.EnsureBoundsCorrect();
            tipsData.Setdata(iconurl, nametext, datacount);
            tipsDatas.Add(tipsData);
            tipsData.starttweener();
        }
    public GButton AddItem(string caption, string caption_right, EventCallback0 callback)
    {
        GButton item = _listItem.AddItemFromPool().asButton;

        item.title  = caption;
        item.data   = callback;
        item.grayed = false;
        item.GetChild("t_right").asTextField.text = caption_right;
        Controller c = item.GetController("checked");

        if (c != null)
        {
            c.selectedIndex = 0;
        }
        return(item);
    }
Beispiel #5
0
    public GButton AddItem(string caption, EventCallback0 callback)
    {
        GButton item = _listItem.AddItemFromPool().asButton;

        item.title  = caption;
        item.data   = callback;
        item.grayed = false;
        Controller c = item.GetController("checked");

        if (c != null)
        {
            c.selectedIndex = 0;
        }
        _resetItem(item);
        return(item);
    }
Beispiel #6
0
        public void Fresh()
        {
            SetMaxHp(charactor.MaxHp);
            SetHp(charactor.NowHp);

            ArmorController.selectedIndex = charactor.GetBuff <Buff_Armor>().Amount > 0 ? 0 : 1;
            //GHpBar.text = $"{charactor.NowHp}/{charactor.MaxHp}";
            //GHpBar.GetChild("Block").text = charactor.GetBuff<Buff_Armor>().Amount.ToString();

            buffList.RemoveChildrenToPool();
            foreach (var buff in charactor.GetBuffs())
            {
                GComponent g = buffList.AddItemFromPool().asCom;
                g.icon = buff.Icon;
                g.text = buff.Amount == 0 ? "" : buff.Amount.ToString();
            }
        }
Beispiel #7
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();
         });
     }
 }
Beispiel #8
0
        //start
        void Start()
        {
            mRootUI = GetComponent <UIPanel>().ui;

            mQuestionDescrib    = mRootUI.GetChild("QuestionDescribPanel").asCom;
            mAnswerAreaPanel    = mRootUI.GetChild("AnswerAreaPanel").asCom;
            mAnswerAreaControll = mAnswerAreaPanel.GetController("QuestypeControll");

            mHeadIconLoad = mRootUI.GetChild("user_icon").asLoader;
            //头像右侧个人空间
            GList mHeadCenterlist = mRootUI.GetChild("userinfol_ist").asList;

            mHeadCenterlist.RemoveChildren();

            for (int i = 0; i < 5; i++)
            {
                GButton mHeadCenterListItem = mHeadCenterlist.AddItemFromPool().asButton;
                mHeadCenterListItem.text = "个人空间";
            }

            mHeadCenterlist.onClickItem.Add(OnHeadCenterListClick);

            //题目列表list
            GList mQuestionList = mRootUI.GetChild("id_list").asList;

            mQuestionList.RemoveChildren();
            for (int j = 0; j < mListQuestion.Count; j++)
            {
                GButton mQuestionListItem = mQuestionList.AddItemFromPool().asButton;
                mListQuestion[j].questionState = mQuestionListItem.GetController("btncolor");
                mQuestionListItem.text         = j.ToString();
            }

            mQuestionList.onClickItem.Add(OnQuestionListItemClick);

            //按钮初始化
            mRootUI.GetChild("save_btn").asButton.onClick.Add(OnSaveBtnClick);
            mRootUI.GetChild("submit_btn").asButton.onClick.Add(OnSubmitBtnClick);
            mRootUI.GetChild("zoombtn").asButton.onClick.Add(OnZoomingBtnClick);
            mRootUI.GetChild("closebtn").asButton.onClick.Add(OnCloseBtnClick);

            //倒计时标志开始初始化
            mCountDownText = mRootUI.GetChild("timerlimit").asTextField;

            mHasStartCountDown = true;
        }
Beispiel #9
0
    public GButton AddAction(string caption, EventCallback0 callback)
    {
        GButton item = _listAtion.AddItemFromPool().asButton;

        item.title = caption;
        item.onClick.Clear();
        if (callback != null)
        {
            item.onClick.Add(callback);
        }
        else
        {
            item.grayed = true;
        }
        // item.data = callback;
        // item.grayed = false;
        return(item);
    }
Beispiel #10
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Extension");
        UIObjectFactory.SetPackageItemExtension("ui://Extension/mailItem", typeof(MailItem));

        _mainView = UIPackage.CreateObject("Extension", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _list = _mainView.GetChild("mailList").asList;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.AddItemFromPool();
            item.setFetched(i % 3 == 0);
            item.setRead(i % 2 == 0);
            item.setTime("5 Nov 2015 16:24:33");
            item.title = "Mail title here";
        }

        _list.EnsureBoundsCorrect();
        float delay = 0f;

        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.GetChildAt(i);
            if (_list.IsChildInView(item))
            {
                item.PlayEffect(delay);
                delay += 0.2f;
            }
            else
            {
                break;
            }
        }
    }
Beispiel #11
0
    public void updateView()
    {
        _hp.text    = PlayerData.getInstance().hp + "";
        _san.text   = PlayerData.getInstance().san + "";
        _money.text = PlayerData.getInstance().money + "";

        UsableHeroInfo heroinfo = GameStaticData.getInstance().heroes [PlayerData.getInstance().heroIdx];

        for (int i = 0; i < heroinfo.talent.Length; i++)
        {
            int ii = i;
            _talents [i].onClick.Add(delegate() {
                if (heroinfo.talent [ii] == null)
                {
                    GameManager.getInstance().showDetailAmplifier("无天赋", null);
                }
                else
                {
                    GameManager.getInstance().showDetailAmplifier("talent", heroinfo.talent [ii]);
                }
            });
        }
//		for (int i = 0; i < _talents.Length; i++) {
//			_talents [i].onTouchBegin.Add (delegate() {
//				UsableHeroInfo heroinfo = GameStaticData.getInstance().heroes[PlayerData.getInstance().heroIdx]
//				GameManager.getInstance().showDetailAmplifier("减少生命上限");
//			});
//		}
        l0.RemoveChildrenToPool();
        l1.RemoveChildrenToPool();

        foreach (Potion p in PlayerData.getInstance().potions)
        {
            PotionSmall item = (PotionSmall)l0.AddItemFromPool();
            item.setInfo(p);
        }
        foreach (Scar scar in PlayerData.getInstance().scars)
        {
            ScarSmallIcon item = (ScarSmallIcon)l1.AddItemFromPool();
            item.setInfo(scar);
        }
    }
Beispiel #12
0
        bool UpdateItems()
        {
            string[] savePaths = Directory
                                 .EnumerateDirectories(Paths.Saves)
                                 .Where(p => !items.Contains(Path.GetFileName(p)))
                                 .OrderBy(p => File.GetLastAccessTimeUtc(p))
                                 .ToArray();

            for (int i = 0; i < savePaths.Length; ++i)
            {
                string name = Path.GetFileName(savePaths[i]);
                items.Add(name);

                var item = scrollview.AddItemFromPool() as PuzzleItem;
                scrollview.SetChildIndex(item, 0);
                item.Init(name);
            }

            return(savePaths.Length > 0);
        }
Beispiel #13
0
        private void OnRoomList(Packet packet)
        {
            this._root.CloseModalWait();

            GRoot.inst.HidePopup();

            GList list = this._root["list"].asList;

            _DTO_room_list dto = (( _PACKET_HALL_ACMD_ROOM_LIST )packet).dto;

            _DTO_room_info[] rooms = dto.rs;
            int count = rooms.Length;

            for (int i = 0; i < count; i++)
            {
                GComponent     item    = list.AddItemFromPool().asCom;
                _DTO_room_info roomDTO = rooms[i];
                item["id"].asTextField.text   = string.Empty + roomDTO.roomId;
                item["name"].asTextField.text = roomDTO.name;
                item.data = roomDTO;
            }
        }
Beispiel #14
0
    private void _onChangedTopic(Icons icons, OnPick callback)
    {
        _bt_pick.visible = false;
        _image.visible   = false;
        var data = icons.data;

        for (int i = 0; i < data.Length; i++)
        {
            GButton item = _list_icon.AddItemFromPool().asButton;
            item.title = data[i];
        }
        _list_icon.onClickItem.Add((EventContext context) => {
            string icon      = data[_list_icon.selectedIndex];
            _bt_pick.visible = true;
            _bt_pick.onClick.Clear();
            _bt_pick.onClick.Add(() => {
                callback(icons.topic, icon);
            });
            _image.visible = true;
            _image.texture = new NTexture(Resources.Load <Texture2D>("Icons/" + icons.topic + "/" + icon));
        });
    }
Beispiel #15
0
        public ListEffectScene()
        {
            UIPackage.AddPackage("UI/Extension");
            UIObjectFactory.SetPackageItemExtension("ui://Extension/mailItem", typeof(MailItem));

            _mainView = UIPackage.CreateObject("Extension", "Main").asCom;
            _mainView.MakeFullScreen();
            _mainView.AddRelation(GRoot.inst, RelationType.Size);
            AddChild(_mainView);

            _list = _mainView.GetChild("mailList").asList;
            for (int i = 0; i < 10; i++)
            {
                MailItem item = (MailItem)_list.AddItemFromPool();
                item.setFetched(i % 3 == 0);
                item.setRead(i % 2 == 0);
                item.setTime("5 Nov 2015 16:24:33");
                item.title = "Mail title here";
            }

            _list.EnsureBoundsCorrect();
            float delay = 0f;

            for (int i = 0; i < 10; i++)
            {
                MailItem item = (MailItem)_list.GetChildAt(i);
                if (_list.IsChildInView(item))
                {
                    item.PlayEffect(delay);
                    delay += 0.2f;
                }
                else
                {
                    break;
                }
            }
        }
Beispiel #16
0
    void AddMsg(string sender, string senderIcon, string msg, bool fromMe)
    {
        bool isScrollBottom = _list.scrollPane.isBottomMost;

        GButton item = _list.AddItemFromPool(fromMe ? _itemURL2 : _itemURL1).asButton;

        if (!fromMe)
        {
            item.GetChild("name").text = sender;
        }
        item.icon = UIPackage.GetItemURL("Emoji", senderIcon);

        //Recaculate the text width
        GRichTextField tf = item.GetChild("msg").asRichTextField;

        tf.width = tf.initWidth;
        tf.text  = EmojiParser.inst.Parse(msg);
        tf.width = tf.textWidth;

        if (fromMe)
        {
            if (_list.numChildren == 1 || Random.Range(0f, 1f) < 0.5f)
            {
                AddMsg("FairyGUI", "r1", "Today is a good day. [:gz]", false);
            }
        }

        if (_list.numChildren > 30)
        {
            _list.RemoveChildrenToPool(0, _list.numChildren - 30);
        }

        if (isScrollBottom)
        {
            _list.scrollPane.ScrollBottom(true);
        }
    }
Beispiel #17
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;
        }
    }
    private void _onChangedTopic(Pets pets, OnPick callback)
    {
        _bt_pick.visible = false;
        _model.visible   = false;
        var data = pets.data;

        for (int i = 0; i < data.Length; i++)
        {
            GButton item = _list_icon.AddItemFromPool().asButton;
            item.title = data[i];
        }
        _list_icon.onClickItem.Add((EventContext context) => {
            string petName   = data[_list_icon.selectedIndex];
            _bt_pick.visible = true;
            _bt_pick.onClick.Clear();
            _bt_pick.onClick.Add(() => {
                callback(pets.topic, petName);
            });
            _model.visible = true;
            string path    = "pets/" + pets.topic + "/" + petName;
            LoadModelItem(path);
            // _image.texture = new NTexture( Resources.Load<Texture2D>("Icons/" + pets.topic + "/" + icon));
        });
    }
Beispiel #19
0
        public override void Create()
        {
            CharactorList = MainView.GetChild("CharactorList").asList;
            CharactorList.RemoveChildrenToPool();
            GButton choose   = MainView.GetChild("Choose").asButton;
            GButton unChoose = MainView.GetChild("UnChoose").asButton;

            foreach (var a in CharactorConfigFactory.Instance.GetAll())
            {
                GComponent g = CharactorList.AddItemFromPool().asCom;
                g.icon = IconHelper.GetHeadIcon(a.ImageName);
                g.data = a;
                g.onClick.Add(() =>
                {
                    MainView.GetChild("BigImage").asLoader.url = "Hero/" + a.ImageName;
                    NowSelectCharactor = a;
                    NowSelectComponent = g;
                    bool Allselect     = MainCharactor != null && HelpCharactor != null;
                    bool Inselect      = MainCharactor == a | HelpCharactor == a;
                    choose.enabled     = !Allselect && !Inselect;
                    unChoose.enabled   = Inselect;

                    MainView.GetChild("Name").text = a.Name;
                    MainView.GetChild("Desc").text = a.Desc;
                });
            }
            choose.onClick.Add(() =>
            {
                if (MainCharactor == null)
                {
                    MainCharactor = NowSelectCharactor;
                    NowSelectComponent.GetController("Choose").selectedIndex = 1;
                }
                else
                {
                    HelpCharactor = NowSelectCharactor;
                    NowSelectComponent.GetController("Choose").selectedIndex = 2;
                    MainView.GetChild("StartGame").visible = true;
                }
                choose.enabled   = false;
                unChoose.enabled = true;
            });
            unChoose.onClick.Add(() =>
            {
                if (HelpCharactor != null)
                {
                    HelpCharactor = null;
                }
                else
                {
                    MainCharactor = null;
                }
                NowSelectComponent.GetController("Choose").selectedIndex = 0;
                MainView.GetChild("StartGame").visible = false;
                choose.enabled   = true;
                unChoose.enabled = false;
            });
            MainView.GetChild("StartGame").onClick.Add(() =>
            {
                THClimbTower.Game.Instance.StartGame(MainCharactor, HelpCharactor, (int)System.DateTime.Now.Ticks);
                Model.Game.Scene.GetComponent <UIManagerComponent>().LoadSence(UIViewType.Map);
            });
        }
Beispiel #20
0
    private void BagInitiate()
    {
        goodsItemList.RemoveChildrenToPool();
        equationItemList.RemoveChildrenToPool();

        energyprogress1.value = energy1.num;
        energyprogress2.value = energy2.num;
        energyprogress3.value = energy3.num;
        foreach (var item in myBag.itemList)
        {
            if (item != null)
            {
                GButton gButton = goodsItemList.AddItemFromPool().asButton;
                gButton.GetChild("number").asTextField.text = item.itemHeld.ToString();
                gButton.GetChild("icon").asLoader.url       = UIPackage.GetItemURL("NewBagPackage", "goods" + item.Itemid);
                gButton.GetChild("id").asTextField.text     = item.Itemid.ToString();
                gButton.GetChild("title").asTextField.text  = item.itemInfo;
                gButton.onClick.Add(() => { ClickItem(gButton); });
            }
        }
        for (int i = 0; i < 30 - myBag.itemList.Count; i++)
        {
            GButton gButton = goodsItemList.AddItemFromPool().asButton;
            gButton.GetChild("number").asTextField.text = "";
            gButton.GetChild("icon").asLoader.url       = "";
            gButton.GetChild("id").asTextField.text     = "";
            gButton.GetChild("title").asTextField.text  = "";
            gButton.onClick.Add(() => { ClickItem(gButton); });
        }

        foreach (var item in myBag.equationList)
        {
            if (item != null)
            {
                GComponent gComponent = equationItemList.AddItemFromPool().asCom;
                gComponent.GetChild("id").asTextField.text          = item.Equationid.ToString();
                gComponent.GetChild("Equation").asLoader.url        = UIPackage.GetItemURL("NewBagPackage", "reaction" + item.Equationid);
                gComponent.GetChild("FirstEnergy").asLoader.url     = UIPackage.GetItemURL("NewBagPackage", "energy" + item.FirstEnergy);
                gComponent.GetChild("SecondEnergy").asLoader.url    = UIPackage.GetItemURL("NewBagPackage", "energy" + item.SecondEnergy);
                gComponent.GetChild("information").asTextField.text = item.itemInfo;
                string productid = "";
                foreach (var itemid in item.productid)
                {
                    productid += productid + itemid + " ";
                }
                gComponent.GetChild("productid").asTextField.text = productid;
                gComponent.GetChild("UseBtn").asButton.onClick.Add(() => { UseEquation(gComponent); });
            }
        }

        if (button1.selected)
        {
            prop.url       = UIPackage.GetItemURL("NewBagPackage", "prop1");
            mainEnergy.url = UIPackage.GetItemURL("NewBagPackage", "energy1");
        }
        else if (button2.selected)
        {
            prop.url       = UIPackage.GetItemURL("NewBagPackage", "prop2");
            mainEnergy.url = UIPackage.GetItemURL("NewBagPackage", "energy2");
        }
        else if (button3.selected)
        {
            prop.url       = UIPackage.GetItemURL("NewBagPackage", "prop3");
            mainEnergy.url = UIPackage.GetItemURL("NewBagPackage", "energy3");
        }
        else
        {
            prop.url         = UIPackage.GetItemURL("NewBagPackage", "prop1");
            mainEnergy.url   = UIPackage.GetItemURL("NewBagPackage", "energy1");
            propid           = 1;
            button1.selected = true;
        }

        if (myBag.propsItems[0].equation != null)
        {
            EquationItem equation = myBag.propsItems[0].equation;
            chooseEquation.GetChild("equation").asLoader.url     = UIPackage.GetItemURL("NewBagPackage", "reaction" + equation.Equationid);
            chooseEquation.GetChild("FirstEnergy").asLoader.url  = UIPackage.GetItemURL("NewBagPackage", "energy" + equation.FirstEnergy);
            chooseEquation.GetChild("SecondEnergy").asLoader.url = UIPackage.GetItemURL("NewBagPackage", "energy" + equation.SecondEnergy);
            chooseEquation.GetChild("id").asTextField.text       = equation.Equationid.ToString();
            chooseEquation.GetChild("sign").asTextField.text     = "";
            string id = equation.Equationid.ToString();
            chooseEquation.GetChild("actBtn").asButton.onTouchBegin.Add(() => { EquationActBegin(id); });
            chooseEquation.GetChild("actBtn").asButton.onTouchEnd.Add(() => { EquationActEnd(id); });
        }

        button1.onClick.Add(() => { changeProp(1); });
        button2.onClick.Add(() => { changeProp(2); });
        button3.onClick.Add(() => { changeProp(3); });
    }
Beispiel #21
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();
        }
    }
Beispiel #22
0
        private void OnRoomInfo(Packet packet)
        {
            this._root.CloseModalWait();

            _DTO_room_info_detail dto = (( _PACKET_ROOM_ACMD_ROOM_INFO )packet).dto;

            GComboBox maps = this._root["map"].asComboBox;

            maps.value = dto.map;

            GComboBox heros = this._root["hero"].asComboBox;

            _DTO_player_info[] players = dto.players;
            GList t1 = this._root["t1"].asCom["list"].asList;
            GList t2 = this._root["t2"].asCom["list"].asList;

            t1.RemoveChildrenToPool();
            t2.RemoveChildrenToPool();
            for (int i = 0; i < players.Length; i++)
            {
                _DTO_player_info infoDto = players[i];
                GComponent       item    = infoDto.team == 0 ? t1.AddItemFromPool().asCom : t2.AddItemFromPool().asCom;
                item.GetController("c1").selectedIndex = 0;
                item["name"].asTextField.text          = infoDto.name;
                item.GetController("c1").selectedIndex = infoDto.ready ? 1 : 0;
                if (infoDto.uid == CUser.id)
                {
                    heros.value = infoDto.cid;
                }
            }
            this._root["name"].asTextField.text = dto.name;

            GButton fightBtn = this._root["fightBtn"].asButton;

            if (dto.host == CUser.id)
            {
                this._root.GetController("c1").selectedIndex = 0;
                bool isAllPlayerReady = this.IsAllPlayerReady(dto);
                if (isAllPlayerReady)
                {
                    fightBtn.grayed    = false;
                    fightBtn.touchable = true;
                }
                else
                {
                    fightBtn.grayed    = true;
                    fightBtn.touchable = false;
                }
            }
            else
            {
                this._root.GetController("c1").selectedIndex = 1;
            }
        }
Beispiel #23
0
    void changeDetailView()
    {
        _changes.RemoveChildrenToPool();

        string p = "";

        p += "";
        Dictionary <string, int[]> diff = new Dictionary <string, int[]> ();

        _c_before.text = "无";
        _c_after.text  = "无";

        //diff ["name"] = new string[2]{"无     ","     无"};
        if (nowComponent != null)
        {
            _c_before.text = nowComponent.cname.PadLeft(6, ' ');

            //diff ["name"][0] = nowComponent.cname.PadLeft(6,' ');
            foreach (TowerComponentEffect effect in nowComponent.effects)
            {
                if (effect.type == eTowerComponentEffectType.ATK_CHANGE)
                {
                    diff ["atk"] = new int[2] {
                        effect.x, 0
                    };
                }
                else if (effect.type == eTowerComponentEffectType.ATK_RANGE_CHANGE)
                {
                    diff ["atk_range"] = new int[2] {
                        effect.x, 0
                    };
                }
                else if (effect.type == eTowerComponentEffectType.ATK_SPD_CHANGE)
                {
                    diff ["atk_spd"] = new int[2] {
                        effect.x, 0
                    };
                }
                else if (effect.type == eTowerComponentEffectType.EXTRA_ATK)
                {
                    diff ["atk_p_" + effect.x] = new int[2] {
                        effect.y, 0
                    };
                }
                else if (effect.type == eTowerComponentEffectType.EXTRA_ABILITY)
                {
                    diff ["extra_" + effect.extra] = new int[2] {
                        effect.x, 0
                    };
                }
            }
        }
        if (choose != -1)
        {
            TowerComponent tc = PlayerData.getInstance().bagComponents [choose];
            _c_after.text = tc.cname.PadLeft(6, ' ');

            //diff ["name"][1] = tc.cname.PadLeft(6,' ');
            foreach (TowerComponentEffect effect in tc.effects)
            {
                if (effect.type == eTowerComponentEffectType.ATK_CHANGE)
                {
                    if (diff.ContainsKey("atk"))
                    {
                        diff ["atk"] [1] = effect.x;
                    }
                    else
                    {
                        diff ["atk"] = new int[2] {
                            0, effect.x
                        };
                    }
                }
                else if (effect.type == eTowerComponentEffectType.ATK_RANGE_CHANGE)
                {
                    if (diff.ContainsKey("atk_range"))
                    {
                        diff ["atk_range"] [1] = effect.x;
                    }
                    else
                    {
                        diff ["atk_range"] = new int[2] {
                            0, effect.x
                        };
                    }
                }
                else if (effect.type == eTowerComponentEffectType.ATK_SPD_CHANGE)
                {
                    if (diff.ContainsKey("atk_spd"))
                    {
                        diff ["atk_spd"] [1] = effect.x;
                    }
                    else
                    {
                        diff ["atk_spd"] = new int[2] {
                            0, effect.x
                        };
                    }
                }
                else if (effect.type == eTowerComponentEffectType.EXTRA_ATK)
                {
                    if (diff.ContainsKey("atk_" + effect.x))
                    {
                        diff ["atk_p_" + effect.x] [1] = effect.y;
                    }
                    else
                    {
                        diff ["atk_p_" + effect.x] = new int[2] {
                            0, effect.y
                        };
                    }
                }
                else if (effect.type == eTowerComponentEffectType.EXTRA_ABILITY)
                {
                    if (diff.ContainsKey("extra" + effect.extra))
                    {
                        diff ["extra_" + effect.extra] [1] = effect.x;
                    }
                    else
                    {
                        diff ["extra_" + effect.extra] = new int[2] {
                            0, effect.x
                        };
                    }
                }
            }
        }


        p += '\n';

        foreach (var kv in diff)
        {
            if (kv.Key == "name")
            {
                continue;
            }
            if (kv.Key.StartsWith("extra"))
            {
                PropertyCompareLine pline = (PropertyCompareLine)_changes.AddItemFromPool();
                string     sid            = kv.Key.Substring(6);
                TowerSkill ts             = GameStaticData.getInstance().getTowerSkillInfo(sid);
                pline.setAsProperty(ts.skillName, "lv" + kv.Value [1], (kv.Value [1] - kv.Value [0]) + "");
            }
            else if (kv.Key.StartsWith("atk_p"))
            {
                PropertyCompareLine pline = (PropertyCompareLine)_changes.AddItemFromPool();
                string    prop            = kv.Key.Substring(6);
                eProperty pp      = (eProperty)int.Parse(prop);
                string    sv      = string.Format("{0:f1}", kv.Value [1] * 0.001f);
                string    schange = string.Format("{0:f1}", (kv.Value [1] - kv.Value [0]) * 0.001f);

                pline.setAsAtkProperty(pp, sv, schange);
            }
            else
            {
                PropertyCompareLine pline = (PropertyCompareLine)_changes.AddItemFromPool();
                string trueKey            = kv.Key.Replace("_", "\n");
                pline.setAsProperty(trueKey, kv.Value [1] + "", (kv.Value [1] - kv.Value [0]) + "");
            }

            p += kv.Key + "  ";
            p += kv.Value [0];
            p += " << ";
            p += kv.Value [1];
            p += '\n';
        }



        _txt_now.text = p;
    }