Beispiel #1
0
    public bool SC_GetBattleMapInfo(Protomsg.MsgBase d1)
    {
        Debug.Log("SC_GetBattleMapInfo:");
        IMessage IMperson = new Protomsg.SC_GetBattleMapInfo();

        Protomsg.SC_GetBattleMapInfo p1 = (Protomsg.SC_GetBattleMapInfo)IMperson.Descriptor.Parser.ParseFrom(d1.Datas);

        main.GetChild("guildlevel").asTextField.text = "Lv." + p1.BattleMapInfo.NeedLevel;
        //进入
        main.GetChild("pipei").asButton.onClick.Add(() =>
        {
            Protomsg.CS_BattlePiPei msg1 = new Protomsg.CS_BattlePiPei();
            msg1.CopyMapID = p1.BattleMapInfo.ID;
            MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BattlePiPei", msg1);
        });

        //地图信息
        main.GetChild("cancel").asButton.onClick.Add(() =>
        {
            Protomsg.CS_BattleCancel msg1 = new Protomsg.CS_BattleCancel();
            MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_BattleCancel", msg1);
        });

        if (p1.BattleMapInfo.State == 1)//可以匹配
        {
            Controller ct = main.GetController("c1");
            ct.SetSelectedIndex(0);
        }
        else if (p1.BattleMapInfo.State == 2)//匹配中
        {
            Controller ct = main.GetController("c1");
            ct.SetSelectedIndex(1);
        }
        return(true);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        PlayerPrefs.DeleteAll();
        UIPackage.AddPackage("FairyGUI/UIMain");
        UIObjectFactory.SetPackageItemExtension("ui://UIMain/ClickShower", typeof(ShowClickMask));
        hasSave = PlayerPrefs.GetInt("hasSave", 0);

        _main_menu = GetComponent <UIPanel> ().ui;
        _main_menu.GetController("c0").SetSelectedPage("unsave");
        if (hasSave > 0)
        {
            _main_menu.GetController("c0").SetSelectedPage("save");
        }
        _main_menu.GetChild("loadGame").onClick.Add(loadGame);
        _main_menu.GetChild("newGame").onClick.Add(newGame);
        _main_menu.GetChild("options").onClick.Add(options);
        _main_menu.GetChild("quit").onClick.Add(quit);

        //_main_menu.onClick.Add (OnClick);
        _main_menu.onClick.Add(OnClickShow);
        effect = _main_menu.GetChild("effect").asMovieClip;
//		ShowClickMask _maskLayer = (ShowClickMask)UIPackage.CreateObject ("UIMain", "ClickShower").asCom;
//		_maskLayer.SetSize(GRoot.inst.width, GRoot.inst.height);
//		_maskLayer.AddRelation(GRoot.inst, RelationType.Size);
//
//
//
//		GRoot.inst.AddChild(_maskLayer);
//		_main_menu.AddChild (mask);
//		Debug.Log (_main_menu.numChildren);
//		Debug.Log (mask.position);

        _mask = _main_menu.GetChild("mask").asGraph;


        _newHeroPanel = _main_menu.GetChild("newHeroPanel").asCom;
        _info         = _newHeroPanel.GetChild("info").asTextField;
        _desp         = _newHeroPanel.GetChild("desp").asTextField;

        _start_game = _newHeroPanel.GetChild("startGame").asLoader;
        _start_game.onClick.Add(delegate(EventContext context) {
            PlayerData.getInstance().heroIdx = choosedHeroIdx;
            enterGame();
        });

        _hero_list = _newHeroPanel.GetChild("hero_list").asList;
        _hero_list.SetVirtualAndLoop();

        _hero_list.itemRenderer = RenderHeroes;
        _hero_list.numItems     = GameStaticData.getInstance().heroes.Count;
        _hero_list.scrollPane.onScroll.Add(doHeroScrollEffect);
        _hero_list.scrollPane.onScrollEnd.Add(changeHeroDetail);
        doHeroScrollEffect();
        changeHeroDetail();
        {
            _info.text = GameStaticData.getInstance().heroes[choosedHeroIdx].name;
            _desp.text = GameStaticData.getInstance().heroes [choosedHeroIdx].desp;
        }
    }
Beispiel #3
0
    public ExchangeInfo()
    {
        MsgManager.Instance.AddListener("SC_GetExchangeShortCommoditys", new HandleMsg(this.SC_GetExchangeShortCommoditys));
        MsgManager.Instance.AddListener("SC_GetExchangeDetailedCommoditys", new HandleMsg(this.SC_GetExchangeDetailedCommoditys));
        MsgManager.Instance.AddListener("SC_GetSellUIInfo", new HandleMsg(this.SC_GetSellUIInfo));
        MsgManager.Instance.AddListener("SC_GetWorldAuctionItems", new HandleMsg(this.SC_GetWorldAuctionItems));

        //获取数据
        Protomsg.CS_GetExchangeShortCommoditys msg1 = new Protomsg.CS_GetExchangeShortCommoditys();
        MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetExchangeShortCommoditys", msg1);
        AudioManager.Am.Play2DSound(AudioManager.Sound_OpenUI);

        main = UIPackage.CreateObject("GameUI", "exchange").asCom;
        GRoot.inst.AddChild(main);
        main.xy = Tool.GetPosition(0.5f, 0.5f);

        main.GetController("page").onChanged.Add(() => {
            var curpagename = main.GetController("page").selectedPage;
            if (curpagename == "buy")
            {
                //获取数据
                Debug.Log("CS_GetExchangeShortCommoditys");
                Protomsg.CS_GetExchangeShortCommoditys msg2 = new Protomsg.CS_GetExchangeShortCommoditys();
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetExchangeShortCommoditys", msg2);
            }
            else if (curpagename == "sell")
            {
                //获取数据
                Debug.Log("CS_GetSellUIInfo");
                Protomsg.CS_GetSellUIInfo msg2 = new Protomsg.CS_GetSellUIInfo();
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetSellUIInfo", msg2);
            }
            else if (curpagename == "auction")
            {
                //获取数据
                Debug.Log("CS_GetWorldAuctionItems");
                Protomsg.CS_GetWorldAuctionItems msg2 = new Protomsg.CS_GetWorldAuctionItems();
                MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetWorldAuctionItems", msg2);
            }
        });

        main.GetChild("buy").asButton.onClick.Add(() =>
        {
            //获取数据
            Debug.Log("CS_GetExchangeShortCommoditys");
            Protomsg.CS_GetExchangeShortCommoditys msg2 = new Protomsg.CS_GetExchangeShortCommoditys();
            MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetExchangeShortCommoditys", msg2);
        });

        main.GetChild("close").asButton.onClick.Add(() =>
        {
            this.Destroy();
        });
    }
Beispiel #4
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 #5
0
 public void ForceUpdataUI(string url)
 {
     if (loadingView != null)
     {
         loadingView.Dispose();
     }
     view.GetController("type").selectedIndex = 2;
     view.GetChild("UpDateGameBtn").asButton.onClick.Set(() => {
         Application.OpenURL(url);
     });
 }
Beispiel #6
0
 private void ClearItem(GComponent g)
 {
     if (fightModel.freeType == 1)
     {
         g.GetController("c1").selectedIndex = 2;
         g.touchable = false;
     }
     else
     {
         g.GetController("c1").selectedIndex = 1;
     }
 }
Beispiel #7
0
    //发送消息
    public void SendChatMsg()
    {
        if (InputContent.text.Length <= 0)
        {
            return;
        }
        var curpagename = ChatBoxCom.GetController("page").selectedPage;
        //////聊天频道 1附近 2全服 3私聊 4队伍
        var chanel = 1;

        if (curpagename == "zonghe")
        {
            ChangeDest(ZongHe_Chanel, DestPlayerName, DestPlayerUID);
            chanel = ZongHe_Chanel;
        }
        else
        {
            if (curpagename == "duiwu")
            {
                chanel = 4;
            }
            else if (curpagename == "siliao")
            {
                chanel = 3;
            }
            else if (curpagename == "guild")
            {
                chanel = 5;
            }
            else if (curpagename == "quanfu")
            {
                chanel = 2;
            }
        }

        //解析分隔数据
        Protomsg.CS_ChatInfo msg = new Protomsg.CS_ChatInfo();
        msg.Channel       = chanel;
        msg.DestPlayerUID = DestPlayerUID;
        msg.Content       = RemoveTextDest(InputContent.text);

        MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_ChatInfo", msg);

        Debug.Log("sendchatmsg:" + msg.Content);


        InputContent.text = RemoveTextContent(InputContent.text);
    }
Beispiel #8
0
    private void init_controller()
    {
        main_jiemian = com_main.GetController("JieMian");

        open_login    = com_start.GetController("show_login");
        login_registe = com_login.GetController("login_registe");
    }
    public JoystickModule(GComponent mainView)
    {
        onMove = new EventListener(this, "onMove");
        onEnd  = new EventListener(this, "onEnd");

        _button = mainView.GetChild("joystick").asButton;
        _button.changeStateOnClick = false;
        _thumb     = _button.GetChild("thumb");
        _touchArea = mainView.GetChild("joystick_touch").asGraph;
        if (is_show_touch_rect)
        {
            _touchArea.DrawRect(_touchArea.width, _touchArea.height, 1, Color.gray, Color.clear);
        }
        _center        = mainView.GetChild("joystick_center");
        _frame         = mainView.GetChild("joystick_frame").asCom;
        _frame.visible = false;
        //GComponent frameView = UIPackage.CreateObject("Joystick", "frame").asCom;
        _frame_ctrler = _frame.GetController("button");

        _InitX       = _center.x + _center.width / 2;
        _InitY       = _center.y + _center.height / 2;
        touchId      = -1;
        radius       = 60;
        frame_radius = 106;
        locomotion   = Player.Locomotion.Idle;

        can_frame_touch = true;
        _touchArea.onTouchBegin.Add(this.onTouchDown);
    }
Beispiel #10
0
    void SetCoverStatus(GComponent obj, CoverType coverType, bool show)
    {
        Controller c = obj.GetController("side");

        if (show)
        {
            if (c.selectedIndex != 0)
            {
                obj.position = coverType == CoverType.Front ? _backCoverPos : _frontCoverPos;
                obj.parent.SetChildIndexBefore(obj, obj.parent.GetChildIndex(_pagesContainer) + 1);
                c.selectedIndex = 0;                 //front

                if (obj.displayObject.cacheAsBitmap)
                {
                    obj.displayObject.cacheAsBitmap = true;                     //refresh
                }
            }
        }
        else
        {
            if (c.selectedIndex != 1)
            {
                obj.position = coverType == CoverType.Front ? _frontCoverPos : _backCoverPos;
                obj.parent.SetChildIndexBefore(obj, obj.parent.GetChildIndex(_pagesContainer));
                c.selectedIndex = 1;                 //back

                if (obj.displayObject.cacheAsBitmap)
                {
                    obj.displayObject.cacheAsBitmap = true;                     //refresh
                }
            }
        }
    }
Beispiel #11
0
        // 显示指定玩家的牌型图标
        void showNiu(int uid, int type)
        {
            var p = Data.Game.GetPlayer(uid);

            if (p == null)
            {
                return;
            }

            GComponent niu  = UIPackage.CreateObject("qipai", "niu").asCom;
            var        cp   = cardPlaces[p.Index];
            var        cpos = cp.position;

            niu.GetController("niu").selectedIndex = type;
            niu.visible = true;
            if (uid == Data.User.Id)
            {
                cpos.y += 65;
                cpos.x += 65;
                niu.SetScale(1.4f, 1.4f);
            }
            else
            {
                cpos.y += 45;
                cpos.x += 30;
                niu.SetScale(0.8f, 0.8f);
            }

            niu.position = cpos;
            niu.AddRelation(cp, RelationType.Middle_Middle, true);
            niu.AddRelation(cp, RelationType.Center_Center, true);
            ui.AddChild(niu);
            nius.Add(niu);
        }
Beispiel #12
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent <UIPanel>().ui;

        _backBtn         = _mainView.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer  = _mainView.GetChild("container").asCom;
        _viewController = _mainView.GetController("c1");

        _demoObjects = new Dictionary <string, GComponent>();

        int cnt = _mainView.numChildren;

        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _mainView.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
            {
                obj.onClick.Add(runDemo);
            }
        }
    }
Beispiel #13
0
        public void OnEntityCreated(VBio bio)
        {
            Skill[] skills = bio.skills;
            int     count  = bio.numSkills;

            for (int i = 1; i < count; i++)
            {
                Skill      skill     = skills[i];
                GComponent skillGrid = this._skillGrids[i - 1];
                skillGrid.data = skill.id;

                GLoader loader = skillGrid["n2"].asLoader;
                loader.url = skill.icon;
                loader.onClick.Add(this.OnSkillGridClick);

                GButton uButton = skillGrid["n5"].asButton;
                uButton.onClick.Add(this.OnSkillUpgradeBtnClick);

                loader.grayed    = true;
                loader.touchable = false;

                skillGrid["mask"].asImage.fillAmount = 0;

                if (bio.property.skillPoint > 0)
                {
                    skillGrid.GetController("c1").selectedIndex = 1;
                }
            }
        }
Beispiel #14
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);
        GRoot.inst.SetContentScaleFactor(720, 1280);
        _mainView = this.GetComponent <UIPanel>().ui;
        playerlogin.instance.thisuser = AVUser.CurrentUser;
        //username = _mainView.GetChild("username").asButton.title;
        //password = _mainView.GetChild("password").asButton.title;


        username     = _mainView.GetChild("username").asButton.GetChild("title").asTextInput;
        password     = _mainView.GetChild("password").asButton.GetChild("title").asTextInput;
        creatname    = _mainView.GetChild("creatname").asButton.GetChild("title").asTextInput;
        randomStatus = _mainView.GetChild("randomStatus").asButton;
        start        = _mainView.GetChild("start").asButton;
        //Debug.Log(randomStatus);
        randomShow = _mainView.GetChild("randomShow").asTextField;
        //Debug.Log(username);
        //Debug.Log(password);
        login           = _mainView.GetChild("login").asButton;
        signup          = _mainView.GetChild("signup").asButton;
        c1              = _mainView.GetController("c1");
        randomShow.text = string.Format("力量:{0}\n体质:{1}\n耐力:{2}\n敏捷:{3}\n智力:{4}\n", S, P, D, A, I);
    }
    public MainPanel()
    {
        _view = UIPackage.CreateObject("Demo", "Demo").asCom;
        _view.fairyBatching = true;//优化drawcall,可以切换这条语句看效果
        _view.SetSize(GRoot.inst.width, GRoot.inst.height);
        _view.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_view);

        _backBtn         = _view.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer = _view.GetChild("container").asCom;
        _cc            = _view.GetController("c1");

        int cnt = _view.numChildren;

        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _view.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
            {
                obj.onClick.Add(runDemo);
            }
        }

        _demoObjects = new Dictionary <string, GComponent>();
    }
Beispiel #16
0
        public BasicsScene()
        {
            UIConfig.verticalScrollBar   = "ui://Basics/ScrollBar_VT";
            UIConfig.horizontalScrollBar = "ui://Basics/ScrollBar_HZ";
            UIConfig.tooltipsWin         = "ui://Basics/WindowFrame";
            UIConfig.popupMenu           = "ui://Basics/PopupMenu";
            UIConfig.defaultFont         = "Arial";
            UIPackage.AddPackage("UI/Basics");

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

            _backBtn         = _mainView.GetChild("btn_Back");
            _backBtn.visible = false;
            _backBtn.onClick.Add(onClickBack);

            _demoContainer  = _mainView.GetChild("container").asCom;
            _viewController = _mainView.GetController("c1");

            _demoObjects = new Dictionary <string, GComponent>();

            int cnt = _mainView.numChildren;

            for (int i = 0; i < cnt; i++)
            {
                GObject obj = _mainView.GetChildAt(i);
                if (obj.group != null && obj.group.name == "btns")
                {
                    obj.onClick.Add(runDemo);
                }
            }
        }
Beispiel #17
0
        //判断 正确错误
        bool JudgeQuestionAcccuarry(GComponent gc, int[] answer, questionTypeEnum questype)
        {
            if (questype == questionTypeEnum.multiChoice)
            {
                bool  result     = true;
                int[] choiceitem = new int[4];
                choiceitem[0] = gc.GetChild("A_choice").asButton.GetController("button").selectedIndex;
                choiceitem[1] = gc.GetChild("B_choice").asButton.GetController("button").selectedIndex;
                choiceitem[2] = gc.GetChild("C_choice").asButton.GetController("button").selectedIndex;
                choiceitem[3] = gc.GetChild("D_choice").asButton.GetController("button").selectedIndex;

                if (answer.Length != choiceitem.Length)
                {
                    return(false);
                }
                for (int i = 0; i < answer.Length; i++)
                {
                    if (answer[i] != choiceitem[i])
                    {
                        return(false);
                    }
                }
                return(result);
            }
            else
            {
                int selectIndex = gc.GetController("radioncontrol").selectedIndex;
                mListQuestion[currentQuestioID].userSelectedOption = selectIndex;
                if (selectIndex != answer[0])
                {
                    return(false);
                }
                return(true);
            }
        }
Beispiel #18
0
    private void ShowInfo(object[] info, int index)
    {
        this.isEffect = true;
        if (info.Length > index)
        {
            object[]   o = (object[])info [index];
            GComponent g = Tools.GetComponent(Config.COM_POPTEXT).asCom;
            g.touchable           = false;
            g.GetChild("n0").text = Tools.GetMessageById(o [0].ToString());
            g.x = Convert.ToInt32(o [1]) + this.GetXX();
            g.y = Convert.ToInt32(o [2]) + this.GetYY();
            g.GetController("c1").selectedIndex = o [3].ToString() == "0" ? 0 : 1;
            g.scaleY = 0f;
//			g.scale = new Vector2 (0f, 0f);
//			g.TweenScale (new Vector2 (1f, 1f), 1f);
            g.TweenScaleY(1f, 0.5f);

            DOTween.To(() => g.scaleY, x => g.scaleY = x, 1, 0.2f).OnComplete(() => {
                g.InvalidateBatchingState();
                DOTween.Kill(g, true);
            });
            add.AddChild(g);

            TimerManager.inst.Add(1.1f, 1, (float obj) =>
            {
                ShowInfo(info, ++index);
            });
        }
        else
        {
            isEffect = false;
        }
    }
Beispiel #19
0
    void OnTurnComplete()
    {
        _slider.value = _book.currentPage;

        if (_book.isCoverShowing(FairyBook.CoverType.Front))
        {
            _mainView.GetController("bookPos").selectedIndex = 1;
        }
        else if (_book.isCoverShowing(FairyBook.CoverType.Back))
        {
            _mainView.GetController("bookPos").selectedIndex = 2;
        }
        else
        {
            _mainView.GetController("bookPos").selectedIndex = 0;
        }
    }
        void OnPullUpToRefresh()
        {
            GComponent footer = (GComponent)_list2.scrollPane.footer;

            footer.GetController("c1").selectedIndex = 1;
            _list2.scrollPane.LockFooter(footer.sourceHeight);

            //Simulate a async resquest
            Timers.inst.Add(2, 1, (object param) =>
            {
                _list2.numItems += 5;

                //Refresh completed
                footer.GetController("c1").selectedIndex = 0;
                _list2.scrollPane.LockFooter(0);
            });
        }
Beispiel #21
0
 void SetCoverNormal(GComponent obj, CoverType coverType)
 {
     obj.position = coverType == CoverType.Front ? _frontCoverPos : _backCoverPos;
     obj.displayObject.cacheAsBitmap = false;
     obj.touchable = true;
     obj.parent.SetChildIndexBefore(obj, obj.parent.GetChildIndex(_pagesContainer));
     obj.GetController("side").selectedIndex = 1;         //back
 }
 public GameSweet()
 {
     _sweet          = UIPackage.CreateObject("main", "sweet").asCom;
     _SweetCon       = _sweet.GetController("SweetsType");
     _loader         = _sweet.GetChild("icon").asLoader;
     _normalClearTra = _sweet.GetTransition("normal_clear");
     _sweet.visible  = true;
     _sweet.onTouchBegin.Set(OnStart);
     _sweet.onTouchEnd.Set(OnEnd);
 }
Beispiel #23
0
    void Start()
    {
#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
#endif

        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Basics");

#if UNITY_5
        //Use the font names directly
        UIConfig.defaultFont = "Droid Sans,Droid Sans Fallback,Microsoft YaHei";
#else
        //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
        UIConfig.defaultFont = "afont";
#endif

        UIConfig.verticalScrollBar   = UIPackage.GetItemURL("Basics", "ScrollBar_VT");
        UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ");
        UIConfig.popupMenu           = UIPackage.GetItemURL("Basics", "PopupMenu");
        UIConfig.buttonSound         = (AudioClip)UIPackage.GetItemAsset("Basics", "click");

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

        _backBtn         = _mainView.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer  = _mainView.GetChild("container").asCom;
        _viewController = _mainView.GetController("c1");

        _demoObjects = new Dictionary <string, GComponent>();

        int cnt = _mainView.numChildren;
        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _mainView.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
            {
                obj.onClick.Add(runDemo);
            }
        }
    }
Beispiel #24
0
 public void OnEntityAttrChanged(VEntity target, Attr attr, object oldValue, object newValue)
 {
     switch (attr)
     {
     case Attr.SkillPoint:
         int count = VPlayer.instance.numSkills;
         for (int i = 1; i < count; i++)
         {
             GComponent skillGrid = this._skillGrids[i - 1];
             skillGrid.GetController("c1").selectedIndex = ( int )newValue > 0 ? 1 : 0;
         }
         break;
     }
 }
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);

            m_WarriorButton    = UI.GetChild("btn_warrior").asButton;
            m_MagicButton      = UI.GetChild("btn_magic").asButton;
            m_ArcherButton     = UI.GetChild("btn_archer").asButton;
            m_CreateRoleButton = UI.GetChild("btn_CreateRole").asButton;
            m_RoleNamePanel    = UI.GetChild("RoleNamePanel").asCom;
            m_DiceButton       = m_RoleNamePanel.GetChild("btn_Dice").asButton;
            m_NameInput        = m_RoleNamePanel.GetChild("ipt_RoleName").asTextInput;
            m_RoleInfoPanel    = UI.GetChild("RoleInfoPanel").asCom;
            m_RoleInfoCtrl     = m_RoleInfoPanel.GetController("roleInfoCtrl");
        }
Beispiel #26
0
        void CreatMap(THClimbTower.EventType type, params object[] Param)
        {
            Map map = Param[0] as Map;

            GTile.RemoveChildren(0, GTile.numChildren, true);
            GLine.RemoveChildren(0, GLine.numChildren, true);
            foreach (Tile tile in map.GetTiles())
            {
                if (tile is StartTile)
                {
                    continue;
                }
                GComponent btn = UIPackage.CreateObject("Map", "MapBtn").asCom;
                GTile.AddChild(btn);
                btn.GetController("c1").selectedIndex = (int)tile.Type;
                btn.data = tile;
                btn.xy   = Getpos(tile.X, tile.Y);
                if (btn.x + 300 > GTile.width)
                {
                    GTile.width = btn.x + 300;
                }
                btn.onClick.Add(async() =>
                {
                    if (!map.CanMove(tile))
                    {
                        return;
                    }
                    MainView.touchable = false;
                    await btn.GetTransition("t0").PlayAsync();
                    MainView.touchable = true;
                    map.MoveNext(tile);
                });
                btn.onRightClick.Add(() =>
                {
                    //tile.ShowDeltaInfo();
                });
                if (tile is BossTile)
                {
                    continue;
                }
                foreach (Tile next in tile.GetNexts())
                {
                    //Debug.Log("Connect" + tile.pos() + "," + next.pos());
                    ConnectRoom(Getpos(tile.X, tile.Y), Getpos(next.X, next.Y));
                }
            }
            FreshMap(THClimbTower.EventType.FreshMap, map);
            //FreshCards(game.player.Deck);
        }
Beispiel #27
0
    protected override void OnInitPanel()
    {
        if (!isDayNightPanel)
        {
            openAnimCom   = contentPane.GetChild("EyeOpen").asCom;
            closeAnimCom  = contentPane.GetChild("EyeClose").asCom;
            openEye       = openAnimCom.GetChild("Anim_Eye").asMovieClip;
            closeEye      = closeAnimCom.GetChild("Anim_Eye").asMovieClip;
            certainButton = contentPane.GetChild("Btn_Certain").asButton;
        }

        guideMessage      = contentPane.GetChild("GuideMessage").asCom;
        messageController = guideMessage.GetController("c1");
        controller        = contentPane.GetController("c1");
    }
Beispiel #28
0
 protected override void OnInitPanel()
 {
     star       = contentPane.GetTransition("t0");
     loadAnim   = contentPane.GetTransition("t1");
     controller = contentPane.GetController("c1");
     cardButton = contentPane.GetChild("Btn_Card").asButton;
     cardButton.onClick.Add(RotateCard);
     cardFront         = cardButton.GetChild("icon");
     cardFront.visible = false;
     cardBack          = cardButton.GetChild("CardBG");
     guideMessage      = contentPane.GetChild("GuideMessage").asCom;
     messageController = guideMessage.GetController("c1");
     tex_Number        = guideMessage.GetChild("Tex_Number").asTextField;
     tex_ID            = guideMessage.GetChild("Tex_ID").asTextField;
     ShuffleTheCard();
 }
Beispiel #29
0
    public void ForceUpdataCheckFailUI()
    {
        Debug.Log("ForceUpdataCheckFailUI");
        if (loadingView != null)
        {
            loadingView.Dispose();
        }

        if (failView != null)
        {
            return;
        }

        failView = UIPackage.CreateObject("public", "PromptPop").asCom;

        failView.SetSize(GRoot.inst.width, GRoot.inst.height);
        failView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(failView);
        failView.GetController("Prompt").selectedIndex = 11;
        failView.GetChild("Text2").asTextField.text    = "检查更新失败,请确认网络连接后重试";
        failView.GetChild("n9").asButton.onClick.Set(() => {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                return;
            }
            failView.Dispose();
            failView = null;
            Debug.Log("main");
            AppFacade.Instance.StartUp();  //启动游戏
            Debug.Log("StartUp");
            if (gameManager == null)
            {
                gameManager = new GameManager();
            }
            gameManager.AddComponent();
            Timers.inst.Add(1, 1, (pa) => {
                gameManager.Init();
            });

            //gameManager.CheckForceUpdata();
        });
        failView.GetChild("CloseBtn").asButton.visible = false;


        Debug.Log("检查强制更新失败UI");
    }
Beispiel #30
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;
        }