Exemplo n.º 1
0
    protected override void OnInit()
    {
        contentPane       = UIPackage.CreateObject("BattleCity8102", "CreateRoom_Window").asCom;
        createRoomFrame   = contentPane.GetChild("frame").asCom;
        roomNameTextField = createRoomFrame.GetChild("roomNameTextField").asTextField;
        mapComboBox       = createRoomFrame.GetChild("mapComboBox").asComboBox;
        modeComboBox      = createRoomFrame.GetChild("modeComboBox").asComboBox;;
        numComboBox       = createRoomFrame.GetChild("numComboBox").asComboBox;
        tickButton        = createRoomFrame.GetChild("tickButton").asButton;

        tickButton.onClick.Add(() => {
            if (roomNameTextField.text.Equals(""))
            {
                return;
            }
            Room rm            = new Room(roomNameTextField.text, MainUI.player.name, mapComboBox.value, modeComboBox.value, new List <Player> {
            }, System.Convert.ToInt32(numComboBox.value));
            rm.isAlive         = true;
            rm.hostIP          = System.Net.IPAddress.Loopback.ToString();
            MainUI.currentRoom = rm;
            RoomManager.CreateRoom(rm);
            RoomWindow rw = new RoomWindow();
            rw.Show();
            this.Dispose();
        });
    }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     mainUI            = GetComponent <UIPanel>().ui;
     progressBar       = mainUI.GetChild("n0").asProgress;
     comboBox          = mainUI.GetChild("n1").asComboBox;
     progressBar.value = 0;
     comboBox.onChanged.Add(SetComboBoxChange);
 }
 protected override void OnInitPanel()
 {
     contentPane.GetChild("Btn_Return").onClick.Add(() => { ToOtherPanel(UIPanelType.MainPanel); });
     gSlider = contentPane.GetChild("Sli_Sound").asSlider;
     gSlider.onChanged.Add(() => { GameManager.Instance.audioSourceManager.ChangeVolume((int)gSlider.value); });
     gComboBox = contentPane.GetChild("Combo_Language").asComboBox;
     gComboBox.onChanged.Add(SetLanguage);
 }
Exemplo n.º 4
0
    private GComboBox comboBox;                                 //可选下拉框

    // Start is called before the first frame update
    void Start()
    {
        mainUI      = GetComponent <UIPanel>().ui;
        progressBar = mainUI.GetChild("n0").asProgress;
        //设置进度条在5s内到达100
        progressBar.TweenValue(100, 5);
        comboBox = mainUI.GetChild("n7").asComboBox;
        //设置可选下拉框的改变的监听事件
        comboBox.onChanged.Add(SetCompleteTime);
    }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
 protected override void OnInit()
 {
     // Debug.Log("WindowTest OnInit");
     this.SetSize(300, 200);
     this.Center();
     this.contentPane = UIPackage.CreateObject("BlueSkin", "FramePickIcon").asCom;
     _title           = frame.GetChild("title").asTextField;
     _text            = this.contentPane.GetChild("text").asTextField;
     _topic           = this.contentPane.GetChild("topic").asComboBox;
     _list_icon       = this.contentPane.GetChild("list_icon").asList;
     _bt_pick         = this.contentPane.GetChild("bt_pick").asButton;
     _image           = this.contentPane.GetChild("image").asLoader;
 }
Exemplo n.º 7
0
        public override void ConstructFromXML(XML xml)
        {
            base.ConstructFromXML(xml);

            m_ViewState  = this.GetControllerAt(0);
            m_SortType   = this.GetControllerAt(1);
            m_ListFrame  = (GLabel)this.GetChildAt(1);
            m_List       = (GList)this.GetChildAt(7);
            m_LabelCount = (GTextField)this.GetChildAt(8);
            m_CBSort     = (GComboBox)this.GetChildAt(9);
            m_LabelEmpty = (GTextField)this.GetChildAt(11);
            m_BtnBack    = (GButton)this.GetChildAt(12);
        }
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_GUILDCREATE);

        simCfg         = DataManager.inst.systemSimple;
        input          = this.GetChild("n3").asTextInput;
        btn_changeIcon = this.GetChild("n0").asButton;
        img_icon       = btn_changeIcon.GetChild("n0").asLoader;
        btn_create     = this.GetChild("n6").asButton;
        l_goldNeed     = this.GetChild("n7").asTextField;
        bo_suozaidi    = this.GetChild("n10").asComboBox;

        this.GetChild("n2").asTextField.text = Tools.GetMessageById("20129");
        this.GetChild("n9").asTextField.text = Tools.GetMessageById("20130");
        btn_create.text = Tools.GetMessageById("20149");

        this.GetChild("n15").asButton.onClick.Add(OnAddClickInInput);

        Dictionary <string, object> cc = (Dictionary <string, object>)(simCfg ["society_location"]);

        object[] cfgs = (object[])((Dictionary <string, object>)DataManager.inst.guild["society"])["society_icon"];
        MediatorChangeIcon.iconID = cfgs [Tools.GetRandom(0, cfgs.Length - 1)].ToString();
        img_icon.url = Tools.GetResourceUrl("Icon:" + MediatorChangeIcon.iconID);
        string[] str = new string[cc.Count];
        string[] va  = new string[cc.Count];
        int      ii  = 0;

        foreach (string i in cc.Keys)
        {
            str [ii] = Tools.GetMessageById(((object[])cc [i]) [1].ToString());
            va[ii]   = i;
            ii++;
        }
        bo_suozaidi.items  = str;
        bo_suozaidi.values = va;
        input.touchable    = false;
        l_goldNeed.text    = Tools.GetMessageById("20172", new object[] { Convert.ToString((int)cfg ["society_cost"]) });
        input.text         = "";
        input.promptText   = Tools.GetMessageById("20150");
        input.onChanged.Add(OnInputChange);
        //input.maxLength = 8;
//		Tools.GetStringLength ();
        btn_changeIcon.onClick.Add(OnChangeIconViewShow);

        btn_create.onClick.Add(GuildCreate);

        DispatchManager.inst.Register(MainEvent.CHANGE_GUILD_ICON, OnChangeIconHandler);
        this.AddGlobalListener(MainEvent.CHAT_GUILDJOIN, CHAT_GUILDJOIN);
    }
Exemplo n.º 9
0
        protected override void OnInit()
        {
            this.contentPane = UIPackage.CreateObject("qipai", "windowEditClubRoom").asCom;
            this.Center();
            this.modal = true;

            roomTypeController = this.contentPane.GetController("roomType");
            scoreBox           = this.contentPane.GetChild("score").asComboBox;
            tuiBox             = this.contentPane.GetChild("tui").asComboBox;
            countBox           = this.contentPane.GetChild("count").asComboBox;
            timesBox           = this.contentPane.GetChild("times").asComboBox;

            this.contentPane.GetChild("btnCreateClub").asButton.onClick.Add(onBtnCreateClubClick);
        }
Exemplo n.º 10
0
 public HtmlSelect()
 {
     if (resource != null)
     {
         comboBox       = UIPackage.CreateObjectFromURL(resource).asComboBox;
         _changeHandler = () =>
         {
             _owner.DispatchEvent(CHANGED_EVENT, null, this);
         };
     }
     else
     {
         Debug.LogWarning("FairyGUI: Set HtmlSelect.resource first");
     }
 }
Exemplo n.º 11
0
    protected override void OnInit()
    {
        this.contentPane = UIPackage.CreateObject("qipai", "windowCreateRoom").asCom;
        this.Center();
        this.modal = true;

        roomTypeController = this.contentPane.GetController("roomType");
        scoreBox           = this.contentPane.GetChild("score").asComboBox;
        tuiBox             = this.contentPane.GetChild("tui").asComboBox;
        payBox             = this.contentPane.GetChild("pay").asComboBox;
        countBox           = this.contentPane.GetChild("count").asComboBox;
        startBox           = this.contentPane.GetChild("start").asComboBox;
        timesBox           = this.contentPane.GetChild("times").asComboBox;
        countBox.onChanged.Add(onCountBoxChanged);
        roomTypeController.onChanged.Add(onCountBoxChanged);
        this.contentPane.GetChild("btnCreateRoom").asButton.onClick.Add(onBtnCreateRoomClick);
    }
Exemplo n.º 12
0
        protected override void StartFUI()
        {
            this.m_title = this.FUIComponent.Get("n4").GObject.asTextField;

            this.m_lanaguageText = this.FUIComponent.Get("n12").GObject.asTextField;
            this.m_soundText     = this.FUIComponent.Get("n8").GObject.asTextField;
            this.m_headNameText  = this.FUIComponent.Get("n18").GObject.asTextField;
            this.m_headHpText    = this.FUIComponent.Get("n19").GObject.asTextField;
            this.m_rotSpeedText  = this.FUIComponent.Get("n20").GObject.asTextField;



            this.m_name      = this.FUIComponent.Get("n5").GObject.asTextField;
            this.m_dbID      = this.FUIComponent.Get("n6").GObject.asTextField;
            this.m_language  = this.FUIComponent.Get("n13").GObject.asComboBox;
            this.m_sound     = this.FUIComponent.Get("n9").GObject.asButton;
            this.m_volume    = this.FUIComponent.Get("n10").GObject.asSlider;
            this.m_showName  = this.FUIComponent.Get("n22").GObject.asButton;
            this.m_showHP    = this.FUIComponent.Get("n23").GObject.asButton;
            this.m_rotSpeed  = this.FUIComponent.Get("n21").GObject.asSlider;
            this.m_determine = this.FUIComponent.Get("n17").GObject.asButton;

            m_lastVolume = Data.Volume;

            m_determine.onClick.Set(DetermineBtn_OnClick);

            this.m_sound.onChanged.Set(this.SoundBtn_OnChange);

            this.m_volume.onGripTouchEnd.Set(this.VolumeSlider_GripTouchEnd);


            this.m_language.items = this.m_lanageList.ToArray();

            this.m_volume.max = 100;

            this.m_rotSpeed.max = 100;

            this.UI();
        }
Exemplo n.º 13
0
        protected override void StartFUI()
        {
            this.m_closeBtn = this.FUIComponent.Get("Close").GObject.asButton;

            this.m_closeBtn.onClick.Set(this.OnClose);

            this.m_enterBtn = this.FUIComponent.Get("Enter").GObject.asButton;

            this.m_enterBtn.onClick.Set(this.EnterBtn_OnClick);

            IConfig[] configs = Game.Scene.GetComponent <ConfigComponent>().GetAll(typeof(Map)) as IConfig[];

            this.m_roomName = this.FUIComponent.Get("n7").GObject.asLabel;

            this.m_roomName.text = $"{PlayerComponent.Instance.MyPlayer.Name}{Message.Get(1067)}";

            this.m_peopleNum = this.FUIComponent.Get("n2").GObject.asComboBox;

            this.m_peopleNum.items = m_nums;

            this.m_peopleNum.values = m_nums;

            this.m_peopleNum.selectedIndex = 0;

            this.m_map = this.FUIComponent.Get("n6").GObject.asComboBox;

            foreach (IConfig conf in configs)
            {
                Map map = conf as Map;

                if (GameSettingsViewComponent.GetLanguage() == Language.Chinese)
                {
                    this.m_mapNames.Add(map.ChineseMapName);
                }
                else
                {
                    this.m_mapNames.Add(map.EnglishMapName);
                }
                this.m_mapId.Add(map.Id.ToString());
            }

            this.m_map.items = this.m_mapNames.ToArray();

            this.m_map.values = this.m_mapId.ToArray();
            //this.m_map.items = this.m_map.values = this.m_mapNames;

            this.m_map.selectedIndex = 0;

            this.m_bigModel = this.FUIComponent.Get("n10").GObject.asComboBox;

            this.m_bigModel.items = this.m_bigModel.values = this.m_models;

            this.m_smallModel = this.FUIComponent.Get("n11").GObject.asComboBox;

            this.m_bigModel.onChanged.Set(BigModel_OnChange);

            this.m_bigModel.value = this.m_models[0];

            this.m_smallModel.items = this.m_smallModel.values = this.m_rounds;

            this.m_smallModel.selectedIndex = 0;
            //this.m_smallModel.items = this.m_smallModel.values = this.

            this.UI();
        }
Exemplo n.º 14
0
        public void Enter(object roomId)
        {
            NetModule.instance.AddACMDListener(Module.ROOM, Command.ACMD_ROOM_INFO, this.OnRoomInfo);
            NetModule.instance.AddACMDListener(Module.ROOM, Command.ACMD_LEAVE_ROOM, this.OnLeaveRoom);
            NetModule.instance.AddACMDListener(Module.ROOM, Command.ACMD_BEGIN_FIGHT, this.OnBeginFight);

            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_LEAVE_ROOM, this.OnLeaveRoomResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_ROOM_INFO, this.OnRoomInfoResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_CHANGE_TEAM, this.OnChangeTeamResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_CHANGE_MAP, this.OnChangeMapResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_CHANGE_HERO, this.OnChangeHeroResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_BEGIN_FIGHT, this.OnBeginFightResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_ADD_FIGHT_READY, this.OnAddFightReadyResult);
            NetModule.instance.AddQCMDListener(Module.ROOM, Command.QCMD_REMOVE_FIGHT_READY, this.OnRemoveFightReadyResult);

            this._id = ( int )roomId;

            this._root = UIPackage.CreateObject("room", "Main").asCom;
            GRoot.inst.AddChild(this._root);
            this._root.size = GRoot.inst.size;

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

            //fightBtn.grayed = true;
            //fightBtn.touchable = false;
            fightBtn.onClick.Add(this.OnFightBtnClick);

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

            readyBtn.onClick.Add(this.OnReadyBtnClick);

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

            leaveBtn.onClick.Add(this.OnLeaveBtnClick);

            this._root["t1"].onClick.Add(this.OnTeamOneClick);
            this._root["t2"].onClick.Add(this.OnTeamTwoeClick);

            Hashtable mapsDef = Defs.Get("maps");
            GComboBox maps    = this._root["map"].asComboBox;

            maps.popupDirection   = PopupDirection.Downward;
            maps.popupConstraint  = PopupConstraint.Any;
            maps.autoSizeDropdown = true;
            maps.onChanged.Add(this.OnMapChangedBtnClick);
            maps.items  = new string[mapsDef.Count];
            maps.values = new string[mapsDef.Count];
            int i = 0;

            foreach (DictionaryEntry de in mapsDef)
            {
                string id = ( string )de.Key;
                maps.SetItem(i, id);
                maps.values[i] = id;
                ++i;
            }

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

            heros.popupDirection  = PopupDirection.Right;
            heros.popupConstraint = PopupConstraint.Any;
            //heros.autoSizeDropdown = true;
            heros.onChanged.Add(this.OnHeroChangedBtnClick);
            Hashtable entitiesDef = Defs.Get("entities");
            Hashtable heroDef     = new Hashtable();

            foreach (DictionaryEntry de in entitiesDef)
            {
                Hashtable hero = ( Hashtable )de.Value;
                string    id   = ( string )de.Key;
                if (!id.StartsWith("c"))
                {
                    continue;
                }
                heroDef[id] = hero;
            }
            heros.items  = new string[heroDef.Count];
            heros.values = new string[heroDef.Count];
            i            = 0;
            foreach (DictionaryEntry de in heroDef)
            {
                Hashtable hero = ( Hashtable )de.Value;
                string    id   = ( string )de.Key;
                if (!id.StartsWith("c"))
                {
                    continue;
                }
                heros.SetItem(i, hero.GetString("name"));
                heros.values[i] = id;
                ++i;
            }

            GComboBox models = this._root["model"].asComboBox;

            models.popupDirection   = PopupDirection.Downward;
            models.popupConstraint  = PopupConstraint.Any;
            models.autoSizeDropdown = true;
            models.onChanged.Add(this.OnModelChangedBtnClick);
            models.items  = new string[mapsDef.Count];
            models.values = new string[mapsDef.Count];
            for (int j = 0; j < 3; j++)
            {
                models.SetItem(j, j.ToString());
                models.values[j] = j.ToString();
            }

            GComboBox skin = this._root["skin"].asComboBox;

            skin.popupDirection   = PopupDirection.Downward;
            skin.popupConstraint  = PopupConstraint.Any;
            skin.autoSizeDropdown = true;
            skin.onChanged.Add(this.OnSkinChangedBtnClick);
            skin.items  = new string[mapsDef.Count];
            skin.values = new string[mapsDef.Count];
            for (int j = 0; j < 3; j++)
            {
                skin.SetItem(j, j.ToString());
                skin.values[j] = j.ToString();
            }

            this._root.ShowModalWait();
            NetModule.instance.Send(ProtocolManager.PACKET_ROOM_QCMD_ROOM_INFO(-1));
        }
Exemplo n.º 15
0
    public override void Init()
    {
        base.Init();
        Create(Config.VIEW_USERINFO);
        child1 = this.GetChild("n42").asCom;
        child2 = this.GetChild("n51").asCom;
        obj_   = this.GetChild("n45").asGroup;

        t1      = this.GetChild("n2").asTextField;
        t1.text = Tools.GetMessageById("13028");
        textUid = this.GetChild("n3").asTextField;


        t2      = child1.GetChild("n8").asTextField;  //name
        t2.text = Tools.GetMessageById("13027");
        t3      = child1.GetChild("n11").asTextField; //sex
        t3.text = Tools.GetMessageById("13089");
        t4      = child1.GetChild("n10").asTextField;
        t4.text = Tools.GetMessageById("13090");
        t5      = child1.GetChild("n0").asTextField;
        t5.text = Tools.GetMessageById("13091");
        t6      = child1.GetChild("n9").asTextField;//phone
        t6.text = Tools.GetMessageById("13097") + ":";

        t2_      = child2.GetChild("n1").asTextField; //name
        t2_.text = Tools.GetMessageById("13027");
        t3_      = child2.GetChild("n3").asTextField; //sex
        t3_.text = Tools.GetMessageById("13089");
        t6_      = child2.GetChild("n2").asTextField; //phone
        t6_.text = Tools.GetMessageById("13141") + ":";

        t5_       = child2.GetChild("n0").asTextField;
        t5_.text  = Tools.GetMessageById("13091");
        textName_ = child2.GetChild("n9").asTextField;
        phone_    = child2.GetChild("n4").asTextField;
        bg1       = this.GetChild("n55").asImage;
        //comboxSex_ = child2.GetChild("n5").asComboBox;
        //comboxSex = child1.GetChild("n15").asComboBox;
        //listSex.Add(Tools.GetMessageById("13070"));
        //listSex.Add(Tools.GetMessageById("13071"));



        textName   = child1.GetChild("n14").asTextField;
        changeName = child1.GetChild("n31").asButton;
        comboxAge  = child1.GetChild("n19").asComboBox;
        comboxAddr = child1.GetChild("n13").asComboBox;
        comboxAddr.visibleItemCount = 3;
        comboxAddr_ = child2.GetChild("n13").asComboBox;
        comboxAddr_.visibleItemCount = 3;


        phone = child1.GetChild("n12").asTextField;



        changePhone      = child1.GetChild("n20").asButton;
        changePhone.text = Tools.GetMessageById("13086");
        changePhone.onClick.Add(Change_Phone);
        changeAccount      = this.GetChild("n6").asButton;
        changeAccount.text = Tools.GetMessageById("13076");
        changeAccount.onClick.Add(Change_Account);
        changePasswd      = this.GetChild("n32").asButton;
        changePasswd.text = Tools.GetMessageById("13083");
        changePasswd.onClick.Add(Change_Pass);

        textTitle       = this.GetChild("n33").asTextField;
        textTitle.text  = Tools.GetMessageById("13058");
        textContnt      = this.GetChild("n5").asTextField;
        textContnt.text = Tools.GetMessageById("13059");
        maskqq          = GetChild("mask2").asButton;
        maskqq.onClick.Add(ChangeUname);
        maskPhon = GetChild("mask1").asButton;
        maskPhon.onClick.Add(ChangeUname);
        head      = GetChild("n8").asCom;
        loginList = GetChild("n11").asList;
        InitDate();
        this.AddGlobalListener(MainEvent.ROLE_UPDATE, ViewUpdate);
    }
Exemplo n.º 16
0
    void InitServerList()
    {
        //测试数据
        //ServerListInfo[] allServerList = {new ServerListInfo("本地服","127.0.0.1",1118), new ServerListInfo("外网", "119.23.8.72", 1118) };
        ////ServerListInfo[] allServerList = { new ServerListInfo("删档测试服", "119.23.8.72", 1118) };

        //ServerListInfoArr t1 = new ServerListInfoArr();
        //t1.Servers = allServerList;
        //var jsonstr = JsonUtility.ToJson(t1);

        //获取公告
        StartCoroutine(Tool.SendGet(GameLauncherUrl + "/getnotice", (WWW data) => {
            //data.text

            if (data.error != null)
            {
                Debug.Log("获取失败:" + data.error);
                return;
            }
            Debug.Log("公告:" + data.text);
            if (data.text != null && data.text.Length > 0)
            {
                GameNotice = data.text;

                //NetNotice
                var createguildwd = UIPackage.CreateObject("GameUI", "NetNotice").asCom;
                GRoot.inst.AddChild(createguildwd);
                createguildwd.xy = Tool.GetPosition(0.5f, 0.5f);
                createguildwd.GetChild("close").asButton.onClick.Add(() =>
                {
                    createguildwd.Dispose();
                });

                //默认文字
                createguildwd.GetChild("words").asTextField.text = data.text;
            }
        }));


        //获取服务器列表
        StartCoroutine(Tool.SendGet(GameLauncherUrl + "/getserverlist?Platform=win32&Version=1.0.0", (WWW data) => {
            //data.text

            if (data.error != null)
            {
                Debug.Log("获取失败:" + data.error);
                return;
            }

            //默认id
            var defaultid = 0;
            var t2        = JsonUtility.FromJson <ServerListInfoArr>(data.text);

            if (t2.Code != 1)
            {
                Debug.Log("获取失败");
                return;
            }

            var serverlist = t2.Servers;
            Debug.Log("-------------len:" + serverlist.Length);
            var defaultserver = serverlist[defaultid];
            SelectServer      = defaultserver;
            //建立连接
            //MyKcp.Create(defaultserver.ip, defaultserver.port);
            //
            string[] names  = new string[serverlist.Length];
            string[] values = new string[serverlist.Length];
            for (var i = 0; i < serverlist.Length; i++)
            {
                names[i]  = serverlist[i].Name;
                values[i] = "" + i;
            }
            GComboBox combo     = mRoot.GetChild("server").asComboBox;
            combo.items         = names;
            combo.values        = values;
            combo.selectedIndex = defaultid;
            combo.onChanged.Add(() => {
                SelectServer = serverlist[combo.selectedIndex];
            });
        }));

        //Debug.Log("-------------InitServerList:" + jsonstr);
    }
Exemplo n.º 17
0
    private void FindObject()
    {
        this.GetChild("n2").text  = Tools.GetMessageById("13092");
        this.GetChild("n1").text  = Tools.GetMessageById("13093");
        this.GetChild("n5").text  = Tools.GetMessageById("13094");
        this.GetChild("n4").text  = Tools.GetMessageById("13095");
        this.GetChild("n3").text  = Tools.GetMessageById("13096");
        this.GetChild("n15").text = Tools.GetMessageById("13109");
        this.GetChild("n62").text = Tools.GetMessageById("13147") + ":";
        string start = Tools.GetMessageById("13116");
        string close = Tools.GetMessageById("13117");

        gCombox = this.GetChild("n14").asComboBox;
        gCombox.onChanged.Add(() =>
        {
            foreach (object[] v in arr)
            {
                if (v [1].ToString().Equals(gCombox.text))
                {
                    PlatForm.inst.SwitchLanguage(v [0].ToString());
                    roleModel.uids.Clear();
                }
            }
        });
        //音乐
        music = this.GetChild("n56").asButton;
        //music.GetChild ("n4").asTextField.text = start;
        //music.GetChild ("n5").asTextField.text = close;
        if (SoundManager.inst.isMusic)
        {
            music.selected = true;
        }
        else
        {
            music.selected = false;
        }
        music.onClick.Add(() =>
        {
            if (music.selected)
            {
                SoundManager.inst.SetMusic(true);
                userModel.isBGM = true;
            }
            else
            {
                SoundManager.inst.SetMusic(false);
                userModel.isBGM = false;
            }
        });

        //音效
        sound = this.GetChild("n57").asButton;
        //sound.GetChild ("n4").asTextField.text = start;
        //sound.GetChild ("n5").asTextField.text = close;
//		if (SoundManager.inst.isSound)
        sound.selected = SoundManager.inst.isSound;
//		else
//			sound.selected = false;

        sound.onClick.Add(() =>
        {
            if (sound.selected)
            {
                SoundManager.inst.SetSound(true);
                userModel.isSound = true;
            }
            else
            {
                SoundManager.inst.SetSound(false);
                userModel.isSound = false;
            }
        });
        //声音
        voice = this.GetChild("n58").asButton;
        //voice.GetChild ("n4").asTextField.text = start;
        //voice.GetChild ("n5").asTextField.text = close;
        if (isVoice)
        {
            voice.selected = true;
        }
        else
        {
            voice.selected = false;
        }

        voice.onClick.Add(() =>
        {
            if (voice.selected)
            {
                SetVoice(true);
            }
            else
            {
                SetVoice(false);
            }
        });

        //邀请
        request = this.GetChild("n59").asButton;
        //request.GetChild ("n4").asTextField.text = start;
        //request.GetChild ("n5").asTextField.text = close;
        if (isInvite)
        {
            request.selected = true;
        }
        else
        {
            request.selected = false;
        }

        request.onClick.Add(() =>
        {
            if (request.selected)
            {
                SetInvite(true);
            }
            else
            {
                SetInvite(false);
            }
        });


        //关注
        attention = this.GetChild("n60").asButton;
        //attention.GetChild ("n4").asTextField.text = start;
        //attention.GetChild ("n5").asTextField.text = Tools.GetMessageById ("13074");

        if (isAttention)
        {
            attention.selected = true;
        }
        else
        {
            attention.selected = false;
        }

        attention.onClick.Add(() =>
        {
            if (attention.selected)
            {
                SetAttention(true);
            }
            else
            {
                SetAttention(false);
            }
        });

        //求关注
        dream_attention = this.GetChild("n63").asButton;
        //attention.GetChild ("n4").asTextField.text = start;
        //attention.GetChild ("n5").asTextField.text = Tools.GetMessageById ("13074");

        if (isDreamAttetion)
        {
            dream_attention.selected = true;
        }
        else
        {
            dream_attention.selected = false;
        }

        dream_attention.onClick.Add(() =>
        {
            if (dream_attention.selected)
            {
                SetDreamAttention(true);
            }
            else
            {
                SetDreamAttention(false);
            }
        });
    }
Exemplo n.º 18
0
    private void InitItem()
    {
        //        InitTitle(Tools.GetMessageById("33101"));

        group1         = GetChild("n9").asGroup;
        group2         = GetChild("n10").asGroup;
        textTitle      = GetChild("n6").asTextField;
        textTitle.text = Tools.GetMessageById("13128");
        btnOk          = GetChild("n7").asButton;
        btnOk.text     = Tools.GetMessageById("13079");
        btnCancel      = GetChild("n8").asButton;
        btnCancel.text = Tools.GetMessageById("14025");
        group2.visible = true;
        userName       = this.GetChild("n5").asComboBox;
        //		userName.onChanged.Add (() =>
        //		{
        //			uname = userName.text;
        //		});
        //GObject obj= this.GetChild("n3");
        //obj.visible = false;
        //        input_password = obj.asCom.GetChild ("n1").asTextInput;
        //		input_password.promptText = Tools.GetMessageById ("13084");
        //        input_password.maxLength = (int)DataManager.inst.systemSimple["password_num"];
        //        input_password.restrict = Config.REG_NUMORABC;
        //        input_password.displayAsPassword = true;
        List <string[]> pList = LocalStore.GetUids();

        string[] myItem = new string[] { };

        foreach (string[] dic in pList)
        {
            if (dic[0] == userModel.uid)
            {
                myItem = dic;
                pList.Remove(dic);
                break;
            }
        }

//        string[] tempItem= pList[0];
//        pList[pList.IndexOf(myItem)] = tempItem;
//        pList[0] = myItem;
//        if (pList.Count != 0)
//        {
        foreach (string[] dic in pList)
        {
            ulist.Add(dic[1]);
            //            if (dic [0] != userModel.uid) {
            //	ulist.Add (dic [1]);
            //}
        }

        ulist.Add(Tools.GetMessageById("13066"));
        userName.items = ulist.ToArray();

        //			uid = ((object[])pList[0])[0].ToString();
        //			uname = ((object[])pList[0])[1].ToString();
//			pwd = myItem[2];
        //            utype = ((object[])pList[0])[3].ToString();
        uInfo = myItem;
        userName.onChanged.Add(() =>
        {
            if (userName.selectedIndex == ulist.Count - 1)
            {
                ViewManager.inst.CloseView();
                ViewManager.inst.ShowView <MediatorChangeAccountIcon>();
            }
            else
            {
                uInfo = (string[])pList[userName.selectedIndex];

                if (uInfo[0].ToString() == userModel.uid)
                {
                    ViewManager.inst.CloseView(this);
                }
                else
                {
                    group1.visible = true;
                    group2.visible = false;
//                       pwd = uInfo[2].ToString();
                    //						utype = uInfo[3].ToString();
                }
            }
        });
//        }
//        else
//        {
//            //userName.text = Tools.GetMessageById ("13102");
        userName.text = userModel.uname;
//        }
        btn_ok      = this.GetChild("n0").asButton;
        btn_ok.text = Tools.GetMessageById("13076");

        btnCancel.onClick.Add(() =>
        {
            ViewManager.inst.CloseView();
        });


        btnOk.onClick.Add(() =>
        {
            if (userName.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13033"));
            }
            else
            {
                if (uInfo != null && uInfo.Length > 0)
                {
                    Send(uInfo[0], uInfo[2], uInfo[3]);
                }
            }
        });


        btn_ok.onClick.Add(() =>
        {
            if (userName.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13033"));
            }
            else
            {
                if (uInfo != null && uInfo.Length > 0)
                {
                    Send(uInfo[0], uInfo[2], uInfo[3]);
                }
            }
        });
    }
Exemplo n.º 19
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_GUILDSEARCH);

        userModel = ModelManager.inst.userModel;

        simCfg            = DataManager.inst.systemSimple;
        btn_search        = this.GetChild("n2").asButton;
        btn_tuijian       = this.GetChild("n4").asButton;
        btn_sort          = this.GetChild("n3").asButton;
        L_Input           = this.GetChild("n0").asTextInput;
        list              = this.GetChild("n13").asList;
        bo_suozaidi       = this.GetChild("n16").asComboBox;
        L_NumericStepper0 = this.GetChild("n7") as ComNumeric;
        L_NumericStepper1 = this.GetChild("n8") as ComNumeric;
        L_NumericStepper2 = this.GetChild("n9") as ComNumeric;

        this.GetChild("n12").asGroup.visible = false;
        GButton b = this.GetChild("n11").asButton;

        b.text = Tools.GetMessageById("20140");
        b.onClick.Add(OnBtnSure);
        L_Input.text       = "";
        L_Input.promptText = Tools.GetMessageById("20116");
        list.itemRenderer  = ListRander;

        bg = this.GetChild("n14");
        BaseMediator.emptyBg = bg;
        list.emptyStr        = Tools.GetMessageById("19936");
        list.onChangeNum.Add(this.CheckListNum);
        list.SetVirtual();


        btn_search.text  = Tools.GetMessageById("20137");
        btn_sort.text    = Tools.GetMessageById("20138");
        btn_tuijian.text = Tools.GetMessageById("20139");
        this.GetChild("n5").asTextField.text  = Tools.GetMessageById("20141");
        this.GetChild("n10").asTextField.text = Tools.GetMessageById("20142");
        this.GetChild("n6").asTextField.text  = Tools.GetMessageById("20143");
        list.numItems = 0;

        btn_search.GetChild("n6").asLoader.url = Tools.GetResourceUrl("Image2:n_btn_7");
        btn_search.GetChild("title").asTextField.strokeColor = Tools.GetColor("486fcc");
//		btn_tuijian.GetChild ("n6").asLoader.url = Tools.GetResourceUrl("Image:btn_9");
//		btn_sort.GetChild ("n6").asLoader.url = Tools.GetResourceUrl("Image:btn_9");

        Dictionary <string, object> cc = (Dictionary <string, object>)(simCfg ["society_location"]);

        string[] str = new string[cc.Count];
        string[] va  = new string[cc.Count];
        int      ii  = 0;

        foreach (string i in cc.Keys)
        {
            str [ii] = Tools.GetMessageById(((object[])cc [i]) [1].ToString());
            va[ii]   = i;
            ii++;
        }
        bo_suozaidi.items  = str;
        bo_suozaidi.values = va;

        L_NumericStepper0.SetMinMax(0, 50, 10);
        L_NumericStepper1.SetMinMax(0, 50, 10);
        L_NumericStepper2.SetMinMax(0, 1000, 100);

        btn_search.onClick.Add(OnBtnSearchHandler);
        btn_tuijian.onClick.Add(OnBtnTuJianHandler);
        btn_sort.onClick.Add(OnBtnSortHandler);
        OnBtnTuJianHandler();
        this.AddGlobalListener(MainEvent.CHAT_GUILDJOIN, CHAT_GUILDJOIN);
    }
Exemplo n.º 20
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_GUILDSETUP, false, Tools.GetMessageById("19919"));

        Dictionary <string, object> data = (Dictionary <string, object>)(Tools.Clone(ModelManager.inst.guildModel.my_guild_info));

        cfg    = (Dictionary <string, object>)(DataManager.inst.guild["society"]);
        simCfg = DataManager.inst.systemSimple;

        btn_changeIcon = this.GetChild("n0").asButton;
        img_icon       = btn_changeIcon.GetChild("n0").asLoader;
        l_name         = this.GetChild("n3").asTextField;
        btn_changeName = this.GetChild("n4").asButton;
        btn_changeGG   = this.GetChild("n8").asButton;
        input_GG       = this.GetChild("n30").asTextInput;
        bo_suozaidi    = this.GetChild("n19").asComboBox;
        btn_changeGG2  = this.GetChild("n36").asButton;

        btn_openZD   = this.GetChild("n24").asButton;
        dro_level    = this.GetChild("n20") as ComNumeric;
        dro_achLevel = this.GetChild("n21") as ComNumeric;
        dro_rank     = this.GetChild("n22") as ComNumeric;

        this.GetChild("n2").asTextField.text  = Tools.GetMessageById("20129");
        this.GetChild("n18").asTextField.text = Tools.GetMessageById("20130");
        this.GetChild("n11").asTextField.text = Tools.GetMessageById("20145");
        this.GetChild("n15").asTextField.text = Tools.GetMessageById("20146");
        this.GetChild("n16").asTextField.text = Tools.GetMessageById("20147");
        this.GetChild("n17").asTextField.text = Tools.GetMessageById("20148");
        this.GetChild("n5").asTextField.text  = Tools.GetMessageById("20128");
        btn_changeGG.text  = Tools.GetMessageById("20128");
        btn_changeGG2.text = Tools.GetMessageById("20175");

        Dictionary <string, object> cc = (Dictionary <string, object>)(simCfg ["society_location"]);

        string[] str      = new string[cc.Count];
        string[] va       = new string[cc.Count];
        int      ii       = 0;
        int      nowIndex = 0;

        foreach (string i in cc.Keys)
        {
            if (i == ModelManager.inst.guildModel.location.ToString())
            {
                nowIndex = ii;
            }
            str [ii] = Tools.GetMessageById(((object[])cc [i]) [1].ToString());
            va[ii]   = i;
            ii++;
        }
        bo_suozaidi.items         = str;
        bo_suozaidi.values        = va;
        bo_suozaidi.selectedIndex = nowIndex;
        bo_suozaidi.onChanged.Add(BoSuozaidiChange);


        img_icon.url       = Tools.GetResourceUrl("Icon:" + (string)(data ["icon"]));
        icon               = (string)(data ["icon"]);
        l_name.text        = (string)(data ["name"]);
        input_GG.maxLength = (int)cfg ["society_notice"];
        input_GG.text      = (data ["content"]).ToString();
        contentText        = input_GG.text;
        this.GetChild("n7").asTextField.text = cfg ["name_change"].ToString();
        this.GetChild("n9").asTextField.text = Tools.GetMessageById("20144");
//		btn_changeName.SetText (Tools.GetMessageById("20113",new string[]{cfg ["name_change"].ToString()}));
//		l_name.onFocusIn.Add(OnNameFocusIn);
//		l_name.onClick.Add(OnNameFocusIn);
        input_GG.onChanged.Add(OnInputContentChange);
//		input_GG.onFocusIn.Add (OnInputFocusIn);
//		input_GG.onFocusOut.Add (OnInputFocusInOut);

        btn_changeName.onClick.Add(OnClickChangeName);
        btn_changeGG.onClick.Add(OnClickChangeGG);
        btn_changeGG2.onClick.Add(OnClickChangeGG2);
        btn_changeIcon.onClick.Add(OnClickChangeIcon);
        btn_openZD.onClick.Add(OnClickOpenZD);
        btn_changeGG.visible = false;



        attrs = (Dictionary <string, object>)((Dictionary <string, object>)data ["attrs"])["join_condition"];
        if (attrs.ContainsKey("lv") && attrs["lv"] != null)
        {
            level = attrs ["lv"].ToString();
        }
        if (attrs.ContainsKey("effort_lv") && attrs["effort_lv"] != null)
        {
            achlevel = attrs ["effort_lv"].ToString();
        }
        if (attrs.ContainsKey("rank_score") && attrs["rank_score"] != null)
        {
            rank = attrs ["rank_score"].ToString();
        }
        if (attrs.ContainsKey("type") && attrs["type"] != null)
        {
            type = attrs ["type"].ToString();
        }
        if (type == "1")
        {
            btn_openZD.GetChild("n6").asLoader.url       = Tools.GetResourceUrl("Image2:n_btn_17");
            this.GetChild("n25").asTextField.text        = Tools.GetMessageById("20111");
            this.GetChild("n25").asTextField.strokeColor = Tools.GetColor("52b04f");
//			btn_openZD.SetText ();
        }
        else
        {
//			btn_openZD.SetText (Tools.GetMessageById("20110"));
            btn_openZD.GetChild("n6").asLoader.url       = Tools.GetResourceUrl("Image2:n_btn_16");
            this.GetChild("n25").asTextField.text        = Tools.GetMessageById("20110");
            this.GetChild("n25").asTextField.strokeColor = Tools.GetColor("d7734d");
        }
        droDownInit();

        dro_level.OnChange    = DroLevelChange;
        dro_achLevel.OnChange = DroAchLevelChange;
        dro_rank.OnChange     = DroRankChange;

        this.AddGlobalListener(MainEvent.CHANGE_GUILD_ICON, OnChangeIconHandler);
        this.AddGlobalListener(MainEvent.CHANGE_GUILD_NAME, OnChangeNameHandler);
    }