Beispiel #1
0
    void Start()
    {
        Application.targetFrameRate = 60;
        DontDestroyOnLoad(this.gameObject);

        Stage.Instantiate(5);
        Stage.inst.AddChild(new GRoot().displayObject);
        Stage.inst.camera.clearFlags = CameraClearFlags.Depth;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        GRoot.inst.SetContentScaleFactor(1136, 640);

        UIPackage.AddPackage("UI/CustomMaterialDemo");

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

        _btn0 = _mainView.GetChild("b0").asButton;
        _btn0.icon = "k0";
        _time1 = 5;
        _mat0 = new Material(Shader.Find("Cooldown mask"));
        _mat0.SetFloat("_Progress", 0f);
        _mat0.SetTexture("_MaskTex", (Texture)Resources.Load("CooldownMask"));
        _btn0.GetChild("icon").asLoader.material = _mat0;

        _btn1 = _mainView.GetChild("b1").asButton;
        _btn1.icon = "k1";
        _time2 = 10;
        _mat1 = new Material(Shader.Find("Cooldown mask"));
        _mat1.SetFloat("_Progress", 0f);
        _mat1.SetTexture("_MaskTex", (Texture)Resources.Load("CooldownMask"));
        _btn1.GetChild("icon").asLoader.material = _mat1;
    }
    void Start()
    {
        Application.targetFrameRate = 60;

        Stage.inst.onKeyDown.Add(OnKeyDown);

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

        _btn0 = _mainView.GetChild("b0").asButton;
        _btn0.icon = "Cooldown/k0";
        _time1 = 5;
        _mask0 = _btn0.GetChild("mask").asImage;

        _btn1 = _mainView.GetChild("b1").asButton;
        _btn1.icon = "Cooldown/k1";
        _time2 = 10;
        _mask1 = _btn1.GetChild("mask").asImage;
    }
    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");
        _center = mainView.GetChild("joystick_center");

        _InitX = _center.x + _center.width / 2;
        _InitY = _center.y + _center.height / 2;
        touchId = -1;
        radius = 150;

        _touchArea.onTouchBegin.Add(this.onTouchDown);
    }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Cooldown");

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

        _btn0 = _mainView.GetChild("b0").asButton;
        _btn0.icon = "Cooldown/k0";
        _time1 = 5;
        _mask0 = _btn0.GetChild("mask").asImage;

        _btn1 = _mainView.GetChild("b1").asButton;
        _btn1.icon = "Cooldown/k1";
        _time2 = 10;
        _mask1 = _btn1.GetChild("mask").asImage;
    }
Beispiel #5
0
    void RenderListItem1(int index, GObject obj)
    {
        GButton item = obj.asButton;

        item.title = "Item " + (_list1.numItems - index - 1);
    }
Beispiel #6
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="name"></param>
    /// <param name="caption"></param>
    public void SetItemText(string name, string caption)
    {
        GButton item = _list.GetChild(name).asButton;

        item.title = caption;
    }
    private void SearchRender(int index, GObject item)
    {
        Dictionary <string, object> dc = (Dictionary <string, object>)listData[index];
        GButton    photo          = item.asCom.GetChild("n1").asCom.GetChild("n0").asButton;
        GTextField name           = item.asCom.GetChild("n3").asTextField;
        GTextField guild          = item.asCom.GetChild("n4").asTextField;
        GLoader    achieve        = item.asCom.GetChild("n21").asCom.GetChild("n1").asLoader;
        GTextField status         = item.asCom.GetChild("n9").asTextField;
        GButton    mask_btn       = item.asCom.GetChild("n8").asButton;
        GButton    btn_attention  = item.asCom.GetChild("n7").asButton;
        GTextField attention_text = btn_attention.GetChild("title").asTextField;
        GLoader    btn_image      = btn_attention.asCom.GetChild("n1").asLoader;
        //btn_image.visible = true;
        GObject    reletion  = item.asCom.GetChild("n2");
        GTextField rankScore = item.asCom.GetChild("n21").asCom.GetChild("n2").asTextField;
        GButton    more      = item.asCom.GetChild("n10").asButton;
        GTextField lv        = item.asCom.GetChild("n1").asCom.GetChild("n2").asTextField;
        GLoader    bg        = item.asCom.GetChild("n32").asLoader;

        bg.visible        = false;
        more.visible      = false;
        rankScore.visible = true;
        reletion.visible  = false;
        userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);

        btn_attention.RemoveEventListeners();
        btn_attention.onClick.Add(() => {
            string uid_ = dc["uid"] + "";
            if (!uid_.Equals(userModel.uid))
            {
                Dictionary <string, object> dd = new Dictionary <string, object>();
                dd["fuid"] = dc["uid"];
                NetHttp.inst.Send(NetBase.HTTP_FOLLOW, dd, (VoHttp vo) =>
                {
                    if ((bool)vo.data == true)
                    {
                        roleModel.AddAttentionFight(dc["uid"].ToString());
                        ((Dictionary <string, object>)listData[index])["if_friend"] = true;
                        Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);
                        btn_attention.touchable = false;
                        //                        btn_image.url = Tools.GetResourceUrl("Image:btn_page3");
                        btn_attention.RemoveEventListeners();
                    }
                    else
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13120"));
                    }
                });
            }
            else
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
            }
        });
        if ((bool)dc["if_black"])
        {//是否拉黑
            Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textShieldd, fontSize, textBtnColor, "", 0);
            type = 1;
            btn_attention.touchable = false;
            //            btn_image.url = Tools.GetResourceUrl("Image:btn_page3");
        }
        else
        if ((bool)dc["if_follow"])
        {
            //是否已关注
            Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);
            type = 2;
            btn_attention.touchable = false;
            //            btn_image.url = Tools.GetResourceUrl("Image:btn_page3");
        }
        else
        {
            Tools.SetButtonBgAndColor(btn_attention, btnBgUp, textAttention, fontSize, textBtnColor, textBtnStrokeColor);
            btn_attention.touchable = true;
            //            btn_image.url = Tools.GetResourceUrl("Image:btn_9");
        }

        achieve.url = userModel.GetRankImg((int)dc["rank_score"]);
        mask_btn.RemoveEventListeners();
        mask_btn.onClick.Add(() => {
            roleModel.SetTempData(listData, new int[] { index });
            string uid_ = dc["uid"] + "";
            if (!uid_.Equals(userModel.uid))
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, uid_, roleModel.tab_CurSelect1, roleModel.tab_CurSelect2, roleModel.tab_CurSelect3 }));
            }
            else
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
            }
        });
        lv.text = dc["lv"].ToString();
        string uname = dc["uname"] + "";

        if (uname.Equals(""))
        {
            name.text = dc["uid"] + "";
        }
        else
        {
            name.text = uname;
        }
        string dc_ = (string)dc["head_use"];

        Tools.SetLoaderButtonUrl(photo, ModelUser.GetHeadUrl(dc_));
        if (dc["guild_name"] == null)
        {
            guild.text = Tools.GetMessageById("19955");
        }
        else
        {
            guild.text = dc["guild_name"] + "";
        }
        if (dc.ContainsKey("status"))
        {
            switch ((int)dc["status"])
            {
            case 0:    //离线
                //					bg.url = Tools.GetResourceUrl("Image2:n_bg_zt3");
                status.text = Tools.GetMessageById("19957");
                Tools.SetRootTabTitleStrokeColor(status, "#646EA9", 1);
                break;

            case 1:    //在线
                //					bg.url = Tools.GetResourceUrl("Image2:n_bg_zt1");
                status.text = Tools.GetMessageById("19958");
                Tools.SetRootTabTitleStrokeColor(status, "#63A969", 1);
                break;

            case 2:    //ing
                //					bg.url = Tools.GetResourceUrl("Image2:n_bg_zt2");
                Tools.SetRootTabTitleStrokeColor(status, "#A55A76", 1);
                status.text = Tools.GetMessageById("19959");
                break;
            }
        }
        rankScore.text = dc["rank_score"] + "";
    }
Beispiel #8
0
        //用户头像右侧按钮List
        void OnHeadCenterListClick(EventContext context)
        {
            GButton itemObj = (GButton)context.data;

            Debug.LogError(itemObj.text);
        }
    public static string[] TextFild(int index, CardVo card, GButton n3 = null, GComponent _view = null, bool isUp = true, bool careExp = true)
    {
        string n1 = "";
        Dictionary <string, object> cardData = (Dictionary <string, object>)DataManager.inst.card [card.id];
        Dictionary <string, object> sim      = (Dictionary <string, object>)(DataManager.inst.systemSimple ["card_attr_info"]);

        object[] tips = (object[])cardData ["tips"];
        Dictionary <string, object> tipi = (Dictionary <string, object>)tips [index];
        Dictionary <string, object> up;

        if (cardData.ContainsKey("up"))
        {
            up = (Dictionary <string, object>)cardData ["up"];
        }
        if (n3 != null)
        {
            n3.visible = false;
        }
        bool bo = false;
        Dictionary <string, object> monster = new Dictionary <string, object> ();
        string carr   = tipi.ContainsKey("call") ? tipi ["call"].ToString() : null;
        string callin = tipi.ContainsKey("callin") ? tipi ["callin"].ToString() : null;

        if (carr != null)
        {
            monster = (Dictionary <string, object>)DataManager.inst.beckon [carr];
        }
        if (callin != null)
        {
            if (n3 != null)
            {
                n3.visible = true;
                n3.onClick.Add(() =>
                {
                    ModelManager.inst.cardModel.SetComShipInfoData(callin, tipi ["title"].ToString(), cardData, card);
                    Vector2 v2 = Stage.inst.touchPosition;

                    MediatorComShipInfo bbb = new MediatorComShipInfo();
                    ViewManager.inst.AddPView(bbb);
                    bbb.setSelectIndex(1);
                    v2          = _view.parent.GlobalToLocal(v2);
                    bbb.group.x = v2.x - bbb.group.width + 175;
                    bbb.group.y = v2.y - bbb.group.height - 20;
                });
            }
        }
        string fa1   = null;
        string fa2   = null;
        int    round = 0;

        if (((Dictionary <string, object>)sim [tipi ["type"].ToString()]).ContainsKey("round"))
        {
            round = Convert.ToInt32(((Dictionary <string, object>)sim [tipi ["type"].ToString()]) ["round"]);
        }
        if (tipi.ContainsKey("replace"))
        {
            object[] replace = (object[])tipi ["replace"];
            string[] strArr  = new string[replace.Length];
            string[] strArr2 = new string[replace.Length];
            for (int j = 0; j < replace.Length; j++)
            {
                string[] fafa;
                if (carr != null)
                {
                    fafa = MediatorItemShipInfo.suanShu((object[])replace [j], monster, card, round);
                }
                else
                {
                    fafa = MediatorItemShipInfo.suanShu((object[])replace [j], cardData, card, round);
                }
                strArr [j] = fafa [0];
                if (fafa.Length > 1)
                {
                    bo = true;
                    if (careExp)
                    {
                        if (card.exp < card.maxExp || card.lv == card.maxLv)
                        {
                            bo = false;
                        }
                    }
                    strArr2 [j] = fafa [1];
                }
            }
            n1  = Tools.GetMessageById(((Dictionary <string, object>)sim [tipi ["type"].ToString()]) ["info"].ToString(), strArr);
            fa1 = n1;
            if (false)
            {
                n1 = "";
//				n1 += "[color=#0cff00]";
                n1 += "+" + Tools.GetMessageById(((Dictionary <string, object>)sim [tipi ["type"].ToString()]) ["info"].ToString(), strArr2);
//				n1 += "[/color]";
                fa2 = n1;
            }
        }
        else
        {
            n1  = Tools.GetMessageById(((Dictionary <string, object>)sim [tipi ["type"].ToString()]) ["info"].ToString());
            fa1 = n1;
        }
        if (fa2 == null)
        {
            return(new string[] { fa1 });
        }
        else
        {
            return(new string[] { fa1, fa2 });
        }
    }
Beispiel #10
0
    private void InitItem()
    {
//        InitTitle(Tools.GetMessageById("33105"));
        input_phone           = this.GetChild("n4").asCom.GetChild("n1").asTextInput;
        input_phone.maxLength = 11;
        //input_phone.promptText = Tools.GetMessageById("13086")+":";
        input_code           = this.GetChild("n5").asCom.GetChild("n1").asTextInput;
        input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"];
        //input_code.promptText = Tools.GetMessageById("13098");


        GetChild("n8").asTextField.text = Tools.GetMessageById("13140") + ":";
        GetChild("n9").asTextField.text = Tools.GetMessageById("13098") + ":";

        btn_send      = this.GetChild("n6").asButton;
        btn_send.text = Tools.GetMessageById("13077");
        btn_send.onClick.Add(() =>
        {
            if (input_phone.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13035"));
            }
            else
            {
                if (input_phone.text.Equals(Tools.GetUserTel(userModel.tel)[1]))
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("13142"));
                }
                else
                {
                    string param = "tel_num=" + input_phone.text;
                    NetHttp.inst.Send(NetBase.HTTP_VALIDATE, param, (VoHttp v) =>
                    {
                        //                    Debug.Log(v.data);//true
                        //                    if ((bool)v.data)
                        //                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13049"));
                        timer = ModelManager.inst.gameModel.time;
                        btn_send.touchable = false;
                        btn_send.grayed    = true;
                        TimerManager.inst.Add(1f, 0, Timer);
                        //                    }
                    });
                }
            }
        });

        btn_ok      = this.GetChild("n7").asButton;
        btn_ok.text = Tools.GetMessageById("13079");
        btn_ok.onClick.Add(() =>
        {
            if (input_code.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13034"));
            }
            else if (input_phone.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13035"));
            }
            else
            {
                string param = "sign=" + input_code.text;
                NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) =>
                {
//                    Debug.Log(v.data);
//                    if ((bool)v.data)
//                    {
                    LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid);
                    LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)v.data);
                    LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL);
                    LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text);
                    //
                    userModel.tel = Ex_Local.LOGIN_TYPE_TEL + "|" + input_phone.text;
//						LocalStore.DelUids(userModel.uid);
                    LocalStore.SetUids(userModel.uid, userModel.uname, (string)v.data, Ex_Local.LOGIN_TYPE_TEL, userModel.tel);
                    //
                    Dictionary <string, object> dc = new Dictionary <string, object>();
                    dc.Add("value", "");
                    dc.Add("tag", "chphone");
                    DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc));
                    ViewManager.inst.CloseView(this);

//                    }
                });
            }
        });
    }
 //Functions
 public override void OnClick(GButton caller)
 {
     this.open.SetActive(true);
 }
Beispiel #12
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_REDPACKAGE, false);
        todayUpTime = Convert.ToInt64(Tools.GetSystemSecond()) + (0);
        userModel   = ModelManager.inst.userModel;
        redbagCfg   = DataManager.inst.redbag;

        n20        = this.GetChild("n20").asTextField;
        btn_Rob    = this.GetChild("n13").asButton;
        btn_Give   = this.GetChild("n12").asButton;
        l_TimeInfo = this.GetChild("n8").asTextField;
        l_redcoin  = this.GetChild("n10").asTextField;
        n26        = this.GetChild("n26").asTextField;
        n26.text   = Tools.GetMessageById("13155");
//		GameObject asd = EffectManager.inst.AddEffect (Config.EFFECT_MAILBOX,"stand", this.GetChild ("n1").asGraph);
//		GameObjectScaler.ScaleParticles (asd, 0);
//		EffectManager.inst.StopAnimation (asd);
//		TimerManager.inst.Add (0.01f, 1, (float obj) => {
//			EffectManager.inst.StopAnimation (asd);
//		});
//		view.GetChild ("n10").asTextField.text = Tools.GetMessageById ("12014");
        ViewManager.inst.AddTouchTip("GButton", this.GetChild("n11").asButton, new Dictionary <string, object> {
            { Config.ASSET_REDBAGCOIN, 1 }
        });
//		view.GetChild ("n15").asTextField.text = Tools.GetMessageById ("12022", new object[]{ redbagCfg ["exp"] });
        btn_Give.text = Tools.GetMessageById("12024");
        btn_Rob.text  = Tools.GetMessageById("12025");
        n26.visible   = false;
        this.GetChild("n24").visible = false;
        btn_Rob.onClick.Add(OnRobRedViewHandler);
        btn_Give.onClick.Add(OnGiveRedViewHandler);
        n20.text        = "";
        l_TimeInfo.text = "";
        OnUpdataHandler();
        if ((int)(ModelManager.inst.userModel.records ["redbag_coin"]) < 1)
        {
            btn_Give.text = Tools.GetMessageById("12018");
            n26.visible   = true;
            userModel.Remove_Notice(btn_Give);
        }
        else
        {
            this.GetChild("n24").visible = true;
            //btn_Give.GetChild ("title").y -= 15;
            this.GetChild("n22").asTextField.text = Tools.GetMessageById("12022", new object[] { (int)redbagCfg ["exp"] * (int)userModel.records ["redbag_coin"] + "" });
            if ((int)userModel.records ["redbag_coin"] > (int)DataManager.inst.redbag ["redpoint"])
            {
                userModel.Add_Notice(btn_Give, new Vector2(130, -10));
            }
            else
            {
                userModel.Remove_Notice(btn_Give);
            }
        }
        TimerManager.inst.Add(1f, 0, Time_Tick);
        Time_Tick(0f);

//		view.GetChild ("n18").asButton.onClick.Add (() => {
//			ViewManager.inst.CloseView(this);
//		});
        this.AddGlobalListener(MainEvent.RED_GIFT, OnUpdataHandler);
    }
        void Start()
        {
            UIPanel    panel = gameObject.GetComponent <UIPanel>();
            GComponent view  = panel.ui; // 整个UI的集合

            GButton StoryButton = view.GetChild("StoryButton").asButton;

            StoryButton.onClick.Add(StoryButton_Click);
            m_story = view.GetChild("Story").asGroup;
            GComponent storyMask = view.GetChild("StoryMask").asCom;

            storyMask.onClick.Add(storyMask_Click);
            GLabel chapter1 = view.GetChild("Chapter1").asLabel;

            chapter1.onClick.Add(Chapter_Click1);
            GLabel chapter2 = view.GetChild("Chapter2").asLabel;

            chapter2.onClick.Add(Chapter_Click2);
            GLabel chapter3 = view.GetChild("Chapter3").asLabel;

            chapter3.onClick.Add(Chapter_Click3);
            GLabel chapter4 = view.GetChild("Chapter4").asLabel;

            chapter4.onClick.Add(Chapter_Click4);
            GLabel chapter5 = view.GetChild("Chapter5").asLabel;

            chapter5.onClick.Add(Chapter_Click5);

            GButton HistoryButton = view.GetChild("HistoryButton").asButton;

            HistoryButton.onClick.Add(HistoryButton_Click);
            GComponent ListMask = view.GetChild("ListMask").asCom;

            ListMask.onClick.Add(ListMask_Click);

            m_personList = view.GetChild("PersonList").asGroup;
            GList      list  = view.GetChild("List").asList;
            GComponent Taoxi = list.GetChild("Taoxi").asCom;

            Taoxi.onClick.Add(Taoxi_Click);
            GComponent Lee = list.GetChild("Lee").asCom;

            Lee.onClick.Add(Lee_Click);
            GComponent Grandpa = list.GetChild("Grandpa").asCom;

            Grandpa.onClick.Add(Grandpa_Click);
            GComponent Grace = list.GetChild("Grace").asCom;

            Grace.onClick.Add(Grace_Click);
            GComponent CURE = list.GetChild("CURE").asCom;

            CURE.onClick.Add(CURE_Click);

            TaoxiView = view.GetChild("Taoxi").asGroup;
            TaoxiView.onClick.Add(Taoxi_Click);
            LeeView = view.GetChild("Lee").asGroup;
            LeeView.onClick.Add(Lee_Click);
            GrandpaView = view.GetChild("Grandpa").asGroup;
            GrandpaView.onClick.Add(Grandpa_Click);
            GraceView = view.GetChild("Grace").asGroup;
            GraceView.onClick.Add(Grace_Click);
            CUREView = view.GetChild("CURE").asGroup;
            CUREView.onClick.Add(CURE_Click);

            GButton ClueButton = view.GetChild("ClueButton").asButton;

            ClueButton.onClick.Add(ClueButton_Click);
            m_clue        = view.GetChild("Clue").asGroup;
            m_clueCaption = view.GetChild("ClueCaption").asLabel;
            m_clueContent = view.GetChild("ClueContent").asLabel;
            GButton rightButton = view.GetChild("RightButton").asButton;

            rightButton.onClick.Add(rightButton_Click);
            GButton leftButton = view.GetChild("LeftButton").asButton;

            leftButton.onClick.Add(leftButton_Click);
            GComponent clueMask = view.GetChild("ClueMask").asCom;

            clueMask.onClick.Add(clueMask_Click);
        }
    private void OnRenderer(int index, GObject item)
    {
        GButton btn = item.asCom.GetChild("n11").asButton;

        //Tools.Btn_Change(btn, "Image:btn_10", "13018");
        btn.touchable = false;
        //}
//            else
//            {
//                btnAtr.selectedIndex = 0;
//                ButtonChange();
//    //Tools.Btn_Change(btn, "Image:btn_16", "13013");
//}
//            if (info.ContainsKey("is_black")) {
//                if ((bool)info["is_black"])
//                {//是否拉黑
//                    //Tools.Btn_Change(btn, "Image:btn_10", "13032");



        object[] data = (object[])listData[index];
        Dictionary <string, object> info = (Dictionary <string, object>)data[2]; //userinfo  【1】uid

        object[]   fightData      = (object[])data[1];                           //战斗数据
        GTextField lv             = item.asCom.GetChild("n3").asCom.GetChild("n2").asTextField;
        GGroup     group          = item.asCom.GetChild("n3").asCom.GetChild("n3").asGroup;
        GComponent start          = item.asCom.GetChild("n8").asCom;
        GButton    head           = item.asCom.GetChild("n3").asCom.GetChild("n0").asButton;
        GTextField uname          = item.asCom.GetChild("n4").asTextField;
        GTextField guild          = item.asCom.GetChild("n10").asTextField;
        GTextField core           = item.asCom.GetChild("n7").asTextField;
        GTextField core_type      = item.asCom.GetChild("n5").asTextField;
        GLoader    fight_group    = item.asCom.GetChild("n41").asLoader;
        GTextField group_name     = item.asCom.GetChild("n42").asTextField;
        GComponent com            = item.asCom.GetChild("n35").asCom;
        GComponent start_         = item.asCom.GetChild("n40").asCom;
        GButton    dreamAttention = item.asCom.GetChild("n45").asButton;

        dreamAttention.text = Tools.GetMessageById("13147");
        dreamAttention.onClick.Add(() => {
            if ((int)data[0] <= 0)
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("24228"));
            }
            else
            {
                Dictionary <string, object> data1 = new Dictionary <string, object>();
                data1["fuid"] = data[0];
                NetHttp.inst.Send(NetBase.HTTP_FOLLOW, data1, (VoHttp vo) =>
                {
                    if ((bool)vo.data == true)
                    {
                        roleModel.AddAttentionFight(data[0].ToString());
                        Dictionary <string, object> dataMy = (Dictionary <string, object>)data[2];
                        dataMy["is_friend"] = true;
                        ViewManager.inst.ShowText(Tools.GetMessageById("13045"));
                        //Tools.SetButtonBgAndColor(btn, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);

                        //btn.touchable = false;
                        dreamAttention.visible = false;
                    }
                    else
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13120"));
                    }
                });
            }
        });
        //GGraph icon_start = item.asCom.GetChild("n31").asGraph;

        userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);


        if (info["lv"] != null)
        {
            lv.text = info["lv"].ToString();
        }
        if (info["name"] != null)
        {
            uname.text = info["name"].ToString();
        }
        else
        {
            uname.text = info["uid"].ToString();
        }
        if (info["guild_name"] != null)
        {
            if (info["guild_name"].ToString().Equals(""))
            {
                guild.text = Tools.GetMessageById("19955");
            }
            else
            {
                guild.text = info["guild_name"].ToString();
            }
        }
        else
        {
            guild.text = Tools.GetMessageById("19955");
        }


        object[]      type          = null;
        List <object> userFightData = new List <object>();

        if (data[0].ToString().Equals(userModel.uid))
        {
            mydata = (object[])fightModel.fightData["my_data"];
            List <object> userData = fightModel.GetUserData(data_all, mydata, statementType);
            for (int i = 0; i < 5; i++)
            {
                Dictionary <string, object> dd = new Dictionary <string, object>();
                dd["data"]  = mydata[i];
                dd["rank"]  = (int)userData[i];
                dd["index"] = i;
                userFightData.Insert(i, dd);
            }
            Tools.Sort(userFightData, new string[] { "rank:int:0" });
            Dictionary <string, object> my = (Dictionary <string, object>)userFightData[0];
            type = new object[] { my["index"], my["data"] };
        }
        else
        {
            type = fightModel.GetUserMaxData(index, data_all, info["uid"].ToString(), fightDataTypeChange);
        }


        if (statementType.Equals(ModelFight.FIGHT_MATCH) || statementType.Equals(ModelFight.FIGHT_FREEMATCH1))
        {
            fight_group.visible = false;
            group_name.visible  = false;
            start.visible       = true;
            start_.visible      = false;
            com.visible         = false;


            Tools.StartSetValue(start, (index + 1).ToString(), ((int)myRank["1"] + 1).ToString(), info["uid"].ToString());
            //if (index == 0)
            //{
            //    GameObject g = EffectManager.inst.AddPrefab(Config.EFFECT_LIGHT, icon_start);
            //    GameObjectScaler.Scale(g, 0.8f);
            //    g.transform.localScale *= 0.8f;
            //}
        }
        else
        {
            fight_group.visible = true;
            group_name.visible  = true;
            start.visible       = false;
            start_.visible      = true;
            if (statementType.Equals(ModelFight.FIGHT_FREEMATCH2))
            {
                com.visible = false;

                if ((int)info["rankLevel"] >= 0 && (int)info["rankLevel"] <= 3)
                {
                    fight_group.url = Tools.GetResourceUrl("Image2:n_icon_dui2");
                    Tools.SetRootTabTitleStrokeColor(group_name, "#424F9E", 2);
                    group_name.text = Tools.GetMessageById("24229");
                }
                else
                {
                    fight_group.url = Tools.GetResourceUrl("Image2:n_icon_dui1");
                    Tools.SetRootTabTitleStrokeColor(group_name, "#9A42AA", 2);
                    group_name.text = Tools.GetMessageById("24230");
                }
            }
            else
            {
                com.visible = true;
                GLoader    rankIcon  = com.GetChild("n1").asLoader;
                GTextField rankScore = com.GetChild("n2").asTextField;
                rankIcon.url   = userModel.GetRankImg((int)info["rank_score"]);
                rankScore.text = info["rank_score"].ToString();

                Dictionary <string, object> userInfo = (Dictionary <string, object>)user[2];

                if ((int)userInfo["rankLevel"] <= 4)
                {
                    if ((int)info["rankLevel"] >= 0 && (int)info["rankLevel"] <= 3)
                    {
                        fight_group.url = Tools.GetResourceUrl("Image2:n_icon_dui2");
                        Tools.SetRootTabTitleStrokeColor(group_name, "#424F9E", 2);
                        group_name.text = Tools.GetMessageById("24229");
                    }
                    else
                    {
                        fight_group.url = Tools.GetResourceUrl("Image2:n_icon_dui1");
                        Tools.SetRootTabTitleStrokeColor(group_name, "#9A42AA", 2);
                        group_name.text = Tools.GetMessageById("24230");
                    }
                }
                else
                {
                    if ((int)info["rankLevel"] >= 0 && (int)info["rankLevel"] <= 3)
                    {
                        fight_group.url = Tools.GetResourceUrl("Image2:n_icon_dui1");
                        Tools.SetRootTabTitleStrokeColor(group_name, "#9A42AA", 2);
                        group_name.text = Tools.GetMessageById("24230");
                    }
                    else
                    {
                        fight_group.url = Tools.GetResourceUrl("Image2:n_icon_dui2");
                        Tools.SetRootTabTitleStrokeColor(group_name, "#424F9E", 2);
                        group_name.text = Tools.GetMessageById("24229");
                    }
                }
            }

            if ((bool)info["is_mvp"])
            {
                //Tools.StartSetValue(start_, Tools.GetMessageById("24223"));
                Tools.GetResourceUrlForMVP(start_.GetChild("n1").asLoader, "mvp");
            }
            else
            {
                start_.visible = false;
            }
        }


        if (index == 0)
        {
            core_type.text = fight_tag["0"].ToString();
            core.text      = fightData[0].ToString();
            fightDataTypeChange.Remove(0);
        }
        else
        {
            if (!fight_tag[type[0].ToString()].ToString().Equals(fight_tag["5"].ToString()))
            {
                core_type.text = fight_tag[type[0].ToString()].ToString();
                core.text      = fightData[Convert.ToInt32(type[0])].ToString();
            }
            else
            {
                core_type.text = fight_tag["0"].ToString();
                core.text      = fightData[0].ToString();
            }
            fightDataTypeChange.Remove((int)type[0]);
        }
        //平均分、是否是新记录
        GComponent obj         = item.asCom.GetChild("n38").asCom;
        GImage     new_mark_bg = obj.GetChild("n0").asImage;
        GTextField new_mark    = obj.GetChild("n1").asTextField;

        obj.visible = false;
        if (!statementType.Equals(ModelFight.FIGHT_FREEMATCH1) && !statementType.Equals(ModelFight.FIGHT_FREEMATCH2))
        {
            if (data[0].ToString().Equals(userModel.uid))
            {
                if (type.Length != 0)
                {
                    object[] userType = (object[])myData[Convert.ToUInt32(type[0])];
                    if ((int)userType[2] != 0)
                    {
                        obj.visible   = true;
                        new_mark.text = Tools.GetMessageById("24218");
                    }
                }
            }
            group.visible = true;
            if ((int)info["uid"] > 0)
            {
                if (info["head"] != null)
                {
                    Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)info["head"])["use"].ToString()));
                }
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(info["name"].ToString(), false, true));
            }
        }
        else
        {
            group.visible = false;
            if ((int)info["uid"] > 0)
            {
                if (info["head"] != null)
                {
                    Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)info["head"])["use"].ToString()));
                }
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl("icon_diannao"));
            }
        }
        btn.touchable = true;
        btn.RemoveEventListeners();
        GLoader bg1 = item.asCom.GetChild("n2").asLoader;

        bg1.url = Tools.GetResourceUrl("Image2:n_bg_tanban1");
        //GLoader bg = item.asCom.GetChild("n39").asLoader;



        if (data[0].ToString().Equals(userModel.uid))
        {
            Tools.SetButtonBgAndColor(btn, btnBgUp, "24216", "", textBtnColor, textBtnStrokeColor);
            //bg.visible = true;
            btn.visible = true;
            btn.onClick.Add(() => {
                ViewManager.inst.ShowScene <MediatorUserDataStatemnet>();
            });
        }
        else
        {
            Debug.Log(info["uid"] + "is_friend:" + info["is_friend"] + " ..........request_sign" + (bool)info["request_sign"] + ".................is_black" + (bool)info["is_black"]);
            //bg.visible = false;
            if ((bool)info["is_friend"])
            {
                //Tools.SetButtonBgAndColor(btn, btnBgDo, textAttentiond, fontSize, textBtnColor, "",0);
                //btn.touchable = false;


                if ((bool)info["request_sign"])
                {
                    dreamAttention.visible = false;
                }
            }
            else
            {
                if (info.ContainsKey("is_black"))
                {
                    if (!(bool)info["is_black"])
                    {
                        if ((bool)info["request_sign"])
                        {
                            dreamAttention.visible = true;
                        }
                    }
                    else
                    {
                        //Tools.SetButtonBgAndColor(btn, btnBgDo, textShieldd, fontSize, textBtnColor, "",0);
                        //btn.touchable = false;
                    }
                }


                //Tools.SetButtonBgAndColor(btn, btnBgUp, textAttention, fontSize, textBtnColor, textBtnStrokeColor);
            }

            //btn.onClick.Add(() =>
            //{


            //});
        }
    }
Beispiel #15
0
    private void OnRendere(int index, GObject item)
    {
        GComponent g         = item.asCom;
        GObject    reletion  = g.GetChild("n3");
        GButton    head      = g.GetChild("n2").asCom.GetChild("n0").asButton;
        GTextField name      = g.GetChild("n4").asTextField;
        GTextField guild     = g.GetChild("n5").asTextField;
        GLoader    achieve   = g.GetChild("n29").asCom.GetChild("n1").asLoader;
        GTextField rankScore = g.GetChild("n29").asCom.GetChild("n2").asTextField;
        GTextField msg       = g.GetChild("n6").asTextField;
        GTextField status    = g.GetChild("n7").asTextField;
        GButton    mask_btn  = g.GetChild("n9").asButton;
        GButton    btn_      = g.GetChild("n0").asButton;

        btn_.visible = false;
        GLoader bg = g.GetChild("n32").asLoader;

        userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);

        bool isVisible = SetListCSS(item, listData.ToArray(), index);

        if (isVisible)
        {
            bg.visible       = false;
            reletion.visible = false;

            GTextField lv = g.GetChild("n2").asCom.GetChild("n2").asTextField;
            Dictionary <string, object> dc = (Dictionary <string, object>)listData[index];
            int fans_count = userModel.Get_NoticeState(ModelUser.RED_FANS);
            if ((bool)dc["is_new"])
            {
                userModel.Add_Notice(g, new UnityEngine.Vector2(72, -1), 0, false);
            }
            else
            {
                userModel.Remove_Notice(g);
            }
            achieve.url = userModel.GetRankImg((int)dc["rank_score"]);
            mask_btn.RemoveEventListeners();
            mask_btn.onClick.Add(() => {
                roleModel.SetTempData(null, new int[] { m_PageIndexS, m_PageIndex });
                string uid = dc["uid"] + "";
                if (!uid.Equals(userModel.uid))
                {
                    this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, uid, roleModel.tab_CurSelect1, roleModel.tab_CurSelect2, roleModel.tab_CurSelect3 }));
                }
                else
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
                }
            });
            lv.text = dc["lv"].ToString();
            string uname = dc["uname"] + "";
            if (uname.Equals(""))
            {
                name.text = dc["uid"] + "";
            }
            else
            {
                name.text = uname;
            }
            string dc_ = (string)dc["head_use"];
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(dc_));
            if (dc["guild_name"] == null)
            {
                guild.text = Tools.GetMessageById("19955");
            }
            else
            {
                guild.text = dc["guild_name"] + "";
            }
            Dictionary <string, object> dynamic = (Dictionary <string, object>)dc["dynamic"];
            if (dynamic.Count != 0)
            {
                Tools.DataTimeFormat(msg, (DateTime)dynamic["time"], 0);
                switch (dynamic["type"].ToString())
                {
                case "lv_up":
                    msg.text = Tools.GetMessageById("19937", new object[] { msg.text, dynamic["lv"].ToString() });
                    break;

                case "elv_up":
                    msg.text = Tools.GetMessageById("19938", new object[] { msg.text, Tools.GetEffortName((int)dynamic["elv"]) });
                    break;

                case "match_team":
                    if ((bool)dynamic["if_win"])
                    {
                        if ((bool)dynamic["if_mvp"])
                        {
                            msg.text = Tools.GetMessageById("19939", new object[] { msg.text });
                        }
                        else
                        {
                            msg.text = Tools.GetMessageById("19940", new object[] { msg.text });
                        }
                    }
                    else
                    {
                        if ((bool)dynamic["if_mvp"])
                        {
                            msg.text = Tools.GetMessageById("19941", new object[] { msg.text });
                        }
                        else
                        {
                            msg.text = Tools.GetMessageById("19942", new object[] { msg.text });
                        }
                    }

                    break;

                case "match":
                    msg.text = Tools.GetMessageById("19943", new object[] { msg.text, dynamic["sort"].ToString(), dynamic["kill_num"].ToString() });
                    break;

                case "up_head":
                    msg.text = Tools.GetMessageById("19970", new object[] { msg.text });
                    break;

                case "choose_head":
                    msg.text = Tools.GetMessageById("19971", new object[] { msg.text });
                    break;
                }
            }
            else
            {
                msg.text = "";
            }
            if (dc.ContainsKey("status"))
            {
                switch ((int)dc["status"])
                {
                case 0:
                    //					bg.url = Tools.GetResourceUrl("Image2:n_bg_zt3");
                    status.text = Tools.GetMessageById("19957");
                    Tools.SetRootTabTitleStrokeColor(status, "#646EA9", 1);
                    break;

                case 1:
                    //					bg.url = Tools.GetResourceUrl("Image2:n_bg_zt1");
                    status.text = Tools.GetMessageById("19958");
                    Tools.SetRootTabTitleStrokeColor(status, "#63A969", 1);
                    break;

                case 2:
                    //					bg.url = Tools.GetResourceUrl("Image2:n_bg_zt2");
                    Tools.SetRootTabTitleStrokeColor(status, "#A55A76", 1);
                    status.text = Tools.GetMessageById("19959");
                    break;
                }
            }
            rankScore.text = dc["rank_score"] + "";
        }
    }
 protected void GetFGUIComp()
 {
     btn_back = mainView.GetChild("Button_back").asButton;
     btn_pop  = mainView.GetChild("Button_pop").asButton;
     btn_Next = mainView.GetChild("Button_Next").asButton;
 }
Beispiel #17
0
    public override void Init()
    {
        base.Init();
        this.isAutoClose = false;
        this.Create(Config.VIEW_TEAMMATCH, false);

//		PlatForm.inst.timeout = 20000f;

        fightModel = ModelManager.inst.fightModel;
        roleModel  = ModelManager.inst.roleModel;
        userModel  = ModelManager.inst.userModel;

        fightModel.fightType = ModelFight.FIGHT_MATCHTEAM;

        list           = this.GetChild("n2").asList;
        btn_Enter      = this.GetChild("n3").asButton;
        btn_Enter.text = Tools.GetMessageById("25062");
        btn_Invite     = this.GetChild("n4").asButton;
        c1             = this.GetController("c1");
        text1          = this.GetChild("n7").asTextField;
        text2          = this.GetChild("n8").asTextField;

        text3 = this.GetChild("n9").asTextField;
        //
        btn_Cancel      = this.GetChild("n6").asButton;
        btn_Cancel.text = Tools.GetMessageById("14025");
        btn_Quit        = this.GetChild("n29").asTextField;
        btn_Chat        = this.GetChild("n18").asButton;
        //btn_Chat.text = Tools.GetMessageById("25067");
        btn_Mil = this.GetChild("n19").asButton;
        btn_Mil.GetChild("n2").asTextField.text = Tools.GetMessageById("25067");
        bar      = this.GetChild("n20").asCom as ComProgressBar;
        bar.skin = ComProgressBar.BAR10;
        bar.SetTextVisible(false);
        bar.value = 0;
        bar.max   = 100;

        btn_Close = this.GetChild("close").asButton;
        btn_Close.onClick.Add(this.Close);
        //
        this.GetChild("title").asTextField.text = Tools.GetMessageById("25033");
        //
        btn_Enter.onClick.Add(Enter_Click);
        btn_Invite.onClick.Add(Invite_Click);
        btn_Cancel.onClick.Add(Cancel_Click);
//		btn_Quit.onClick.Add (Quit_Click);
        btn_Quit.text = Tools.GetMessageById("25058");
        btn_Chat.onClick.Add(Chat_Click);
        btn_Mil.onClick.Add(Chat_Click_Over);
        fightModel.isMatch = false;

        //麦克风功能
        micro = new MediatorMicro();
        ViewManager.inst.AddTopView(micro);
        //房间内部操作
        NetSocket.inst.AddListener(NetBase.SOCKET_TEAMMATCH, (VoSocket vo) =>
        {
//				Debug.LogError("NetSocket.inst.AddListener");
            if (vo.data is Boolean)
            {
                bool isOk = Convert.ToBoolean(vo.data);
                if (!isOk)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("25026"));
                    TimerManager.inst.Remove(Time_Tick);
                    fightModel.isMatch = false;
                    list.numItems      = 4;
                    if (fightModel.isLeader)
                    {
                        c1.selectedIndex = 0;
                    }
                    else
                    {
                        c1.selectedIndex = 1;
                    }
                }
            }
            else
            {
                Dictionary <string, object> data = (Dictionary <string, object>)vo.data;
                fightModel.team1 = (object[])data ["team"];
                list.numItems    = 4;             //fightModel.team1.Length;

                c1.selectedIndex = 4;
                this.closeEnable = false;
                text3.text       = Tools.GetMessageById("25064");
                TimerManager.inst.Add(5f, 1, (float t) =>
                {
                    TimerManager.inst.Remove(Time_Tick);
                    c1.selectedIndex = 4;
                    //					Log.debug ("准备开始 - " + vo.data.ToString ());

                    DispatchManager.inst.Dispatch(new MainEvent(MainEvent.START_FIGHT, data));
                });
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_STARTMATCHPUSH, (VoSocket vo) =>
        {
            fightModel.isMatch = true;
            list.numItems      = 4;       //fightModel.team1.Length;

//			NetSocket.inst.RemoveListener (NetBase.SOCKET_STARTMATCH);
            if (fightModel.isLeader)
            {
                c1.selectedIndex = 2;
            }
            else
            {
                c1.selectedIndex = 3;
            }

            fightModel.preTime   = Convert.ToInt32(vo.data);
            fightModel.matchTime = 0;
//			Log.debug ("开始匹配 - " + fightModel.preTime.ToString ());
            if (fightModel.isLeader)
            {
                text1.text = Tools.GetMessageById("25005", new string[] {
                    fightModel.preTime.ToString(),
                    fightModel.matchTime.ToString()
                });
            }
            else
            {
                text2.text = Tools.GetMessageById("25005", new string[] {
                    fightModel.preTime.ToString(),
                    fightModel.matchTime.ToString()
                });
            }
            TimerManager.inst.Add(1f, 0, Time_Tick);
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25013"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_ACCEPTINVITEOTHER, (VoSocket vo) =>
        {
            string uid    = fightModel.AddTeam(vo.data);
            list.numItems = 4;            //fightModel.team1.Length;
            ViewManager.inst.ShowText(Tools.GetMessageById("25012", new String[] { uid }));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_KILLTEAMPUSH, (VoSocket vo) =>
        {
            fightModel.Clear();
            ViewManager.inst.CloseView(this);
            ViewManager.inst.ShowText(Tools.GetMessageById("25008"));
//			Log.debug ("解散队伍 - " + vo.data.ToString ());
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_QUITTEAMPUSH, (VoSocket vo) =>
        {
//			if (vo.data is Boolean && !Convert.ToBoolean (vo.data))
//			{
//				ViewManager.inst.ShowText (Tools.GetMessageById ("25016"));
//				return;
//			}
            string uid = vo.data.ToString();
            if (userModel.uid == uid)
            {
                ViewManager.inst.CloseView(this);
                ViewManager.inst.ShowText(Tools.GetMessageById("25011"));
//				Log.debug ("退出队伍 - " + vo.data.ToString ());
            }
            else
            {
                fightModel.ChangeTeam(vo.data);
                list.numItems = 4;
                if (fightModel.isLeader)
                {
                    c1.selectedIndex = 0;
                }
                else
                {
                    c1.selectedIndex = 1;
                }
                this.btn_Enter.enabled = false;
                TimerManager.inst.Add(2f, 1, (float t) =>
                {
                    this.btn_Enter.enabled = true;
                });
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CANCELMATCHPUSH, (VoSocket vo) =>
        {
            if (!Convert.ToBoolean(vo.data))
            {
                return;
            }
            fightModel.isMatch = false;
            if (fightModel.isLeader)
            {
                c1.selectedIndex = 0;
            }
            else
            {
                c1.selectedIndex = 1;
            }
            TimerManager.inst.Remove(Time_Tick);
            ViewManager.inst.ShowText(Tools.GetMessageById("25015"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_MATCHTEAMCHATPUSH, (VoSocket vo) =>
        {
            if (userModel.IsChatVoice())
            {
                fightModel.AddMicro(vo.data);
            }
        });

        this.AddGlobalListener(MainEvent.SOCKET_CLOSE, (MainEvent e) =>
        {
            this.Close();
        });
        //
        this.InitData();
    }
Beispiel #18
0
    private void InitItem()
    {
//        InitTitle(Tools.GetMessageById("33106"));
        input_password            = this.GetChild("n5").asCom.GetChild("n1").asTextInput;
        input_password.promptText = "";
        input_password.maxLength  = (int)DataManager.inst.systemSimple["password_num"];
        input_password.restrict   = Config.REG_NUMORABC;
        input_phone            = this.GetChild("n3").asCom.GetChild("n1").asTextInput;
        input_phone.maxLength  = 11;
        input_phone.promptText = "";
        input_code             = this.GetChild("n4").asCom.GetChild("n1").asTextInput;
        input_code.maxLength   = (int)DataManager.inst.systemSimple["code_num"];
        input_code.promptText  = "";
        btn_send = this.GetChild("n6").asButton;
        GTextField phone = this.GetChild("n8").asTextField;

        phone.text = Tools.GetMessageById("13097") + ":";
        GTextField passwd = this.GetChild("n9").asTextField;

        passwd.text = Tools.GetMessageById("13098") + ":";
        GTextField code = this.GetChild("n10").asTextField;

        code.text     = Tools.GetMessageById("13084") + ":";
        btn_send.text = Tools.GetMessageById("13077");
        btn_send.onClick.Add(() =>
        {
            if (input_phone.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13035"));
            }
            else
            {
                string param = "tel_num=" + input_phone.text;
                NetHttp.inst.Send(NetBase.HTTP_VALIDATE, param, (VoHttp v) =>
                {
                    Debug.Log(v.data);//true
                    if ((bool)v.data)
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13049"));
                        timer = ModelManager.inst.gameModel.time;
                        btn_send.touchable = false;
                        btn_send.grayed    = true;
                        TimerManager.inst.Add(1f, 0, Timer);
                    }
                });
            }
        });

        btn_ok      = this.GetChild("n7").asButton;
        btn_ok.text = Tools.GetMessageById("13079");
        btn_ok.onClick.Add(() =>
        {
            if (input_password.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("10011"));
            }
            else if (input_code.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13034"));
            }
            else if (input_phone.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13035"));
            }
            else
            {
                string param = "sign=" + input_code.text;
//                param += "|uname=" + userModel.uname;
                param += "|pwd=" + input_password.text;
                NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) =>
                {
//                    Debug.Log(v.data);
                    if ((string)v.data != string.Empty)
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13124"));
                        //
                        LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid);
                        LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)v.data);
                        LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL);
                        LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text);
                        //
                        userModel.tel    = Ex_Local.LOGIN_TYPE_TEL + "|" + input_phone.text;
                        otherInfo["tel"] = userModel.tel;
                        //
//						LocalStore.DelUids(userModel.uid);
                        LocalStore.SetUids(userModel.uid, userModel.uname, (string)v.data, Ex_Local.LOGIN_TYPE_TEL, userModel.tel);
                        //
                        Dictionary <string, object> dc = new Dictionary <string, object>();
                        dc.Add("value", "");
                        dc.Add("tag", "account");
                        DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc));
                        ViewManager.inst.CloseView(this);
                    }
                });
            }
        });
    }
Beispiel #19
0
    //	private void Quit_Click ()
    //	{
    //		Quit_Team ();
    //	}

    private void ItemRender(int index, GObject item)
    {
        GComponent g  = item.asCom;
        Controller c  = g.GetController("c1");
        GComponent bg = g.GetChild("n0").asCom;

        bg.RemoveEventListeners();
        //lht
        g.GetChild("n13").visible = false;
        g.GetChild("n17").visible = false;
        //		if (index % 2 == 0) {
        bg.GetChild("n0").visible = ((index % 2) != 0);
//		Debug.LogError (bg.GetChild ("n0").visible);
        if (index > fightModel.team1.Length - 1)
        {
//			g.GetChild ("n13").visible = false;
            c.selectedIndex = 2;
            if (fightModel.isLeader)
            {
                g.GetChild("n12").text = Tools.GetMessageById("25035");
                bg.onClick.Add(() =>
                {
                    if (fightModel.team1.Length == 4)
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("25048"));
                        return;
                    }
                    fightModel.InviteRequest();
                });
            }
            else
            {
                g.GetChild("n12").text = Tools.GetMessageById("25047");
            }
            if (fightModel.isMatch)
            {
                g.GetChild("n12").text = Tools.GetMessageById("25057");
            }
            return;
        }
        Dictionary <string, object> data = (Dictionary <string, object>)fightModel.team1 [index];

//		if (fightModel.isLeader)
//		{
//		if (data ["uid"].ToString () == userModel.uid)
//			g.GetChild ("n13").visible = true;
//		else
//			g.GetChild ("n13").visible = false;
////		}
//		else
//			g.GetChild ("n13").visible = false;
//		g.GetChild ("n4").asLoader.url = Tools.GetSexUrl (data ["sex"]);
//		}

        g.GetChild("n5").text = ModelUser.GetUname(data ["uid"], data ["name"]);
        g.GetChild("n6").text = data ["guild_name"] == null?Tools.GetMessageById("25034") : data ["guild_name"].ToString();

        GLoader    img = g.GetChild("n11").asCom.GetChild("n1").asLoader;
        GTextField txt = g.GetChild("n11").asCom.GetChild("n2").asTextField;

        img.url  = userModel.GetRankImg(data ["rank_score"]);
        txt.text = data ["rank_score"].ToString();
        GButton head = g.GetChild("n3").asButton;

        head.GetChild("n2").text = data ["lv"].ToString();
        //Tools.SetLoaderButtonUrl (head.GetChild ("n0").asButton, ModelUser.GetHeadUrl (Tools.Analysis (data, "head.use").ToString ()));
        if ((int)data["uid"] > 0)
        {
            Tools.SetLoaderButtonUrl(head.GetChild("n0").asButton, ModelUser.GetHeadUrl(Tools.Analysis(data, "head.use").ToString()));
        }
        else
        {
            Tools.SetLoaderButtonUrl(head.GetChild("n0").asButton, ModelUser.GetHeadUrl(data["name"].ToString(), false, true));
        }

        GButton btn = g.GetChild("n8").asButton;

        btn.text = Tools.GetMessageById("20119");
        if (fightModel.isLeader)
        {
            if (data ["uid"].ToString() == userModel.uid)
            {
                c.selectedIndex = 0;
            }
            else
            {
                c.selectedIndex = 1;
            }
        }
        else
        {
            c.selectedIndex = 0;
        }

        btn.RemoveEventListeners();
        if (fightModel.isMatch)
        {
            btn.enabled = false;
        }
        else
        {
            btn.enabled = true;
        }
        btn.onClick.Add(() =>
        {
            ViewManager.inst.ShowAlert(Tools.GetMessageById("25049"), (int id) =>
            {
                if (id == 1)
                {
                    NetSocket.inst.AddListener(NetBase.SOCKET_QUITTEAM, (VoSocket vo) =>
                    {
                        //踢出队员成功提示,未配置上  25014
                        ViewManager.inst.ShowText(Tools.GetMessageById("25014"));
                        NetSocket.inst.RemoveListener(NetBase.SOCKET_QUITTEAM);
                        Log.debug("踢出队员 - " + vo.data.ToString());
//						ViewManager.inst.ShowText (Tools.GetMessageById ("25014"));
                    });
                    Dictionary <string, object> da = new Dictionary <string, object> ();
                    da ["uid"] = data ["uid"].ToString();
                    NetSocket.inst.Send(NetBase.SOCKET_QUITTEAM, da);
                }
            }, true);
        });
    }
Beispiel #20
0
    private void OnRenderList(int index, GObject go)
    {
        go.alpha = 1;
        go.scale = new Vector2(1f, 1f);
        Dictionary <string, object> _da = (Dictionary <string, object>)lisData [index];
        ComBigIcon     icon             = go.asCom.GetChild("n8") as ComBigIcon;
        ComProgressBar progress         = go.asCom.GetChild("n7") as ComProgressBar;
        GTextField     name             = go.asCom.GetChild("n1").asTextField;
        GTextField     info             = go.asCom.GetChild("n3").asTextField;
        GButton        btn = go.asCom.GetChild("n0").asButton;
        Controller     c1  = go.asCom.GetController("c1");
        GImage         bg  = go.asCom.GetChild("n10").asImage;

        name.text        = Tools.GetMessageById(_da ["name"].ToString());
        info.text        = Tools.GetMessageById(_da ["info"].ToString(), GetTypeByObj(_da ["type"].ToString(), (object[])_da ["need"]));
        progress.skin    = ComProgressBar.BAR5;
        progress.offsetY = 5;
//		ColorFilter gggg = btn.GetChild ("n0").asImage.filter as ColorFilter;
//		gggg.Reset ();


        bool isCard = false;
        Dictionary <string, object> gfit = new Dictionary <string, object> ();
        string giftType = "";

        foreach (string str in ((Dictionary <string, object>)_da["reward"]).Keys)
        {
            if (str == Config.ASSET_CARD)
            {
                isCard = true;
            }
            giftType = str;
            gfit.Add(str, ((Dictionary <string, object>)_da ["reward"]) [str]);
            break;
        }
        if (isCard)
        {
            icon.SetSelectIndex(1);
            icon.SetData(((object[])gfit [Config.ASSET_CARD]) [0].ToString(), ((object[])gfit [Config.ASSET_CARD]) [1].ToString(), 4);
        }
        else
        {
            icon.SetSelectIndex(2);
            icon.SetData(giftType, gfit [giftType]);
        }
        progress.max   = (int)((object[])_da ["need"]) [(((object[])_da ["need"]).Length) - 1];
        progress.value = (int)(_da ["rate"]);

        btn.RemoveEventListeners();
        bool isclick = false;

        btn.onTouchBegin.Add(() =>
        {
            isclick  = true;
            go.scale = new Vector2(0.95f, 0.95f);
        });
        btn.onTouchEnd.Add(() =>
        {
            isclick  = false;
            go.scale = new Vector2(1f, 1f);
        });
        btn.onRollOut.Add(() =>
        {
            if (isclick)
            {
                go.scale = new Vector2(1f, 1f);
            }
        });
        go.asCom.GetChild("n9").asTextField.text  = Tools.GetMessageById("23012");
        progress.GetChild("n1").asTextField.color = Tools.GetColor("E8FCD9");
        if (progress.value >= progress.max)
        {
            btn.touchable    = true;
            c1.selectedIndex = 1;
            EffectManager.inst.TweenHuXi(go.asCom.GetChild("n9").asTextField, 3f);
            bg.color = Tools.GetColor("#FFFF99");
//			EffectManager.inst.SetColorShader (btn.displayObject.gameObject, "FFFF00");
//			gggg.AdjustBrightness (0.1f);
//			gggg.AdjustContrast (0.5f);
//			gggg.AdjustSaturation (0.5f);
//			gggg.AdjustHue (-0.2f);
        }
        else
        {
            btn.touchable = false;
//			btn.GetController ("c1").selectedIndex = 0;
            c1.selectedIndex = 0;
        }
        btn.onClick.Add(() =>
        {
            SoundManager.inst.PlaySound(Config.SOUND_MISSIONREWARD);
            btn.touchable  = false;
            this.touchable = false;
            moveGo         = go;
            nowGift        = gfit;
            nowIndex       = index;

            if (ModelManager.inst.guideModel.CheckEffort() == 2 && items.Count == 1)
            {
                if (GuideManager.inst.Check("100:1"))
                {
                    GuideManager.inst.Next();
                }
            }
            NetHttp.inst.Send(NetBase.HTTP_GETEFFORTREWARD, "index=" + (int)(_da ["index"]), GetReward);
        });
    }
Beispiel #21
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);
        components[0] = (ComponentView)this.GetChild("c0").asCom;
        components[1] = (ComponentView)this.GetChild("c1").asCom;
        components[2] = (ComponentView)this.GetChild("c2").asCom;
        components[3] = (ComponentView)this.GetChild("c3").asCom;

        for (int i = 0; i < 4; i++)
        {
            components [i].idx        = i;
            components [i].towerPanel = this;
            components [i].visible    = false;
            int idx = i;
            components [i].onTouchEnd.Add(delegate() {
                clickComponent(idx);
            });
        }

        towers = this.GetChild("towers").asList;

        _switch_detail          = this.GetChild("switch").asButton;
        _switch_detail.selected = true;
        _switch_detail.onClick.Add(delegate() {
            isDetailShown = !isDetailShown;
            if (isDetailShown)
            {
                for (int i = 0; i < 4; i++)
                {
                    components[i].showDetail();
                }
            }
            else
            {
                for (int i = 0; i < 4; i++)
                {
                    components[i].hideDetail();
                }
            }
        });
        //tComponents = this.GetChild ("components").asList;

        //movingIcon = this.GetChild ("moving_icon").asLoader;
        //movingIcon.sortingOrder = int.MaxValue;

        towers.onClickItem.Add(clickTower);
        towers.itemRenderer = RenderTowers;
        towers.numItems     = PlayerData.getInstance().ownedTowers.Count;

        //tComponents.foldInvisibleItems = true;
        //tComponents.itemRenderer = RenderComponents;
        //tComponents.numItems = PlayerData.getInstance ().bagComponents.Count;
        //tComponents.EnsureBoundsCorrect();

//		DragDropManager.inst.dragAgent.onDragEnd.Add(delegate(EventContext context2) {
//			if(!isDropOnSlot)
//				tComponents.GetChildAt(nowDragIdx).visible = true;
//			tComponents.numItems = PlayerData.getInstance ().bagComponents.Count;
//			nowDragIdx = -1;
//		});

        _property         = (TowerPropertyAfter)this.GetChild("property").asCom;
        _property.visible = false;

        towerComponentWindow = new TowerComponentChooseWindow(this);
    }
Beispiel #22
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_EFFORT, true);

        userModel = ModelManager.inst.userModel;
        effortCfg = (Dictionary <string, object>)(DataManager.inst.effort ["mission"]);

        this.GetChild("n3").asTextField.text = Tools.GetMessageById("23007");
        lisData = new List <object> ();
        int proValue = 0;

        for (int i = 0; i < userModel.effort.Length; i++)
        {
            Dictionary <string, object> da    = (Dictionary <string, object>)userModel.effort [i];
            Dictionary <string, object> dacfg = (Dictionary <string, object>)(effortCfg [da ["eid"].ToString()]);
            Dictionary <string, object> ddd   = new Dictionary <string, object> ();
            ddd.Add("id", da ["eid"].ToString());
            ddd.Add("rate", (int)(da ["rate"]));
            ddd.Add("index", i);
            ddd.Add("name", dacfg ["name"].ToString());
            ddd.Add("info", dacfg ["info"].ToString());
            ddd.Add("type", dacfg ["type"].ToString());
            ddd.Add("need", (object[])dacfg ["need"]);
            ddd.Add("status", (int)(da ["status"]));
            ddd.Add("reward", (Dictionary <string, object>)dacfg ["reward"]);
            int need = (int)((object[])ddd ["need"]) [(((object[])ddd ["need"]).Length) - 1];
            if (((int)ddd ["status"] == 0) && lisData.Count < 4)
            {
                lisData.Add(ddd);
            }
            if ((int)ddd ["status"] == 1)
            {
                proValue++;
            }
        }
        beforeEff_Lv = userModel.effort_lv;
        ball         = this.GetChild("n19").asLoader;
        effort_name  = this.GetChild("n18").asTextField;
        btn_esc      = this.GetChild("n7").asButton;
        c1           = this.GetController("c1");
        c1.onChanged.Add(OnC1Change);
        btn_xx = this.GetChild("n17").asButton;
        list   = this.GetChild("n4").asList;
        pro    = this.GetChild("n12") as ComProgress;
        listxx = this.GetChild("n14").asList;
//		listxx.onTouchBegin.Add (OnBeginDrag);
//		listxx.onTouchEnd.Add (OnEndDrag);

        listxx.itemRenderer = OnRenderListXX;
        listxx.SetVirtual();

        EffectManager.inst.EffectAlpha(this.GetChild("n30").asImage, 0);
        EffectManager.inst.EffectAlpha(this.GetChild("n31").asImage, 0);

        string sid = Tools.GetEffortBuildID("0" + userModel.effort_lv);

        gameobj = EffectManager.inst.AddEffect(sid, "bulid01", btn_xx.GetChild("n2").asGraph, null, false, 50, null, true);
        gameobj.transform.localPosition += new Vector3(0f, 70, 0f);
//		GameObjectScaler.Scale (gameobj, 0.8f);
        gameobj.transform.localScale *= 0.9f;
//        Debug.Log(gameobj.transform.localScale);
//		list.itemRenderer = OnRenderList;
//		list.numItems = lisData.Count;
        FrushList();
        if (userModel.effort_lv > ((Dictionary <string, object>)DataManager.inst.effort["effort_cond"]).Count)
        {
            c1.selectedIndex = 2;
        }
//		this.GetChild ("n26").asTextField.text = userModel.effort_lv + "";

        effort_name.text = Tools.GetEffortName(userModel.effort_lv);
        btn_esc.onClick.Add(OnEscBtnClick);
        btn_xx.onClick.Add(OnChangeXX);
        btn_esc.text = Tools.GetMessageById("24111");
        weizhi       = pro.viewWidth / 2 + pro.x;
        ball.visible = false;

        pro.SetMax(userModel.effort.Length);
        pro.SetValue(proValue);
        pro.x = weizhi - pro.viewWidth / 2;
        if (ModelManager.inst.guideModel.CheckEffort() == 2)
        {
            if (GuideManager.inst.Check("100:0"))
            {
                GuideManager.inst.Next();
                GuideManager.inst.Show(this);
            }
        }

//		if (guideModel.CheckEffort () == 2 && GuideManager.inst.Check ("100:0"))
//		{
//			GuideManager.inst.Next(true);
//		}
    }
Beispiel #23
0
    // Use this for initialization
    void Start()
    {
        battleComponent   = GetComponent <UIPanel>().ui;
        boxButton         = battleComponent.GetChild("boxButton").asButton;
        boxButton.visible = false;

        boxButton.onClick.Add(() => {
            boxWindow = new BoxWindow(box);
            boxWindow.Show();
        });

        // 坦克将碰撞到的盒子传递过来,通过判断盒子是否为空表示远离或接近
        Box.boxDelegate += (Box box) => {
            boxButton.visible = box == null ? false : true;
            // 远离盒子时关闭窗口
            if (!boxButton.visible && boxWindow != null)
            {
                boxWindow.Hide();
                boxWindow.Dispose();
                boxWindow          = null;
                boxButton.selected = false;
            }
            this.box = box;
        };

        Tank.goodsDelegate += (List <Goods> goodsList) => {
            // 清除旧窗口
            if (goodsWindow != null)
            {
                goodsWindow.Hide();
                goodsWindow.Dispose();
                goodsWindow = null;
            }
            // 新建新窗口
            createGoodsWindow(goodsList);
        };

        // 注册拖拽事件
        GGroup footer = battleComponent.GetChild("footer").asGroup;

        mulGoodsList = battleComponent.GetChildInGroup(footer, "buttleList").asList;
        sinGoodsList = battleComponent.GetChildInGroup(footer, "goodsList").asList;
        GObject[] mulGoodsButtons = mulGoodsList.GetChildren();
        GObject[] sinGoodsButtons = sinGoodsList.GetChildren();
        getGoodsDelegate += getGoods;

        dragIcon = battleComponent.GetChild("dragIcon").asLoader;
        touchID  = -1;

        bulletEmptyList   = new List <GButton>();
        medecineEmptyList = new List <GButton>();

        for (int i = 0; i < mulGoodsButtons.Length; i++)
        {
            GButton btn = (GButton)mulGoodsButtons[i];
            btn.visible = false;
            addDragAndDrop(btn);

            bulletEmptyList.Add(btn);
        }
        for (int i = 0; i < sinGoodsButtons.Length; i++)
        {
            GButton btn = (GButton)sinGoodsButtons[i];
            btn.visible = false;
            addDragAndDrop(btn);

            // 包含药品、道具
            medecineEmptyList.Add(btn);
        }

        coldDownTable        = new Hashtable();
        bulletColdDownTime   = 0;
        medecineColdDownTime = 0;
    }
Beispiel #24
0
    //	private void TweenMove(int index)
    //	{
    //		float c = curX2;
    //		DOTween.To (() => c, x => c = x, index * -1100, 1f).OnUpdate (() => {
    //			listxx.container.x = c;
    //		});
    //	}

    private void OnRenderListXX(int index, GObject go)
    {
        //		listxx.ch
//		Debug.LogError (index + " || "+listxx.GetChildIndex(go) + " || " +listxx.numItems + " ||  "+curIndex);
//		if (btn_xx.touchable)
//			return;
//		if ((index == (curIndex - 1) || index == (curIndex+1) || index == curIndex)&&addList[index] == 0) {
//			addList [index] = 1;
//		} else
//			return;
        GList      list      = go.asCom.GetChild("n14").asList;
        GTextField tex       = go.asCom.GetChild("n11").asTextField;
        GButton    btn       = go.asCom.GetChild("n12").asButton;
        GTextField effort_lv = go.asCom.GetChild("n9").asTextField;
        GTextField benji     = go.asCom.GetChild("n13").asTextField;
        GTextField dangqian  = go.asCom.GetChild("n16").asTextField;
        GButton    jianzhu   = go.asCom.GetChild("n8").asButton;

//		GImage dangqianImg = go.asCom.GetChild ("n17").asImage;
        GImage n18 = go.asCom.GetChild("n18").asImage;
//		GComponent n19 = go.asCom.GetChild ("n19").asCom;
        GImage n20 = go.asCom.GetChild("n20").asImage;
        GImage n21 = go.asCom.GetChild("n21").asImage;

//		GTextField n23 = go.asCom.GetChild ("n23").asTextField;
        GImage     n24 = go.asCom.GetChild("n24").asImage;
        GImage     n25 = go.asCom.GetChild("n25").asImage;
        GComponent bg  = go.asCom.GetChild("bg").asCom;

//		n23.text = (index + 1) + "";
        btn.touchable = true;
        if (donghuaXX && index == beforeEff_Lv - 1)
        {
            dangqian.alpha  = 0;
            effort_lv.alpha = 0;
            benji.alpha     = 0;
            btn.alpha       = 0;
            tex.alpha       = 0;
            btn_esc.alpha   = 0;
//			dangqianImg.alpha = 0;
            n18.alpha = 0;
//			n19.alpha = 0;
            n20.alpha = 0;
            n21.alpha = 0;
//			n23.alpha = 0;
            n24.alpha = 0;
            n25.alpha = 0;
            bg.alpha  = 0;
            DOTween.Kill(this.GetChild("n30"), true);
            DOTween.Kill(this.GetChild("n31"), true);
            this.GetChild("n30").alpha = 0;
            this.GetChild("n31").alpha = 0;
            jianzhu.x = 400f;
            TimerManager.inst.Add(2f, 1, (float time) =>
            {
                jianzhu.TweenMoveX(170f, 0.6f).OnComplete(() =>
                {
                    float c = 0;
                    DOTween.To(() => c, x => c = x, 1, 0.3f).OnUpdate(() =>
                    {
                        dangqian.alpha  = c;
                        effort_lv.alpha = c;
                        benji.alpha     = c;
                        btn.alpha       = c;
                        tex.alpha       = c;
                        btn_esc.alpha   = c;
//						dangqianImg.alpha = c;
                        n18.alpha = c;
//						n19.alpha = c;
                        n20.alpha = c;
                        n21.alpha = c;

//						n23.alpha = c;
                        n24.alpha = c;
                        n25.alpha = c;
                        bg.alpha  = c;
                        this.GetChild("n30").alpha = c;
                        this.GetChild("n31").alpha = c;
                    }).OnComplete(() => {
                        EffectManager.inst.EffectAlpha(this.GetChild("n30").asImage, 0);
                        EffectManager.inst.EffectAlpha(this.GetChild("n31").asImage, 0);
                    });
                });
            });
        }
        effort_lv.text = Tools.GetEffortName((index + 1));         //GuideManager
        tex.text       = Tools.GetMessageById("23006");
        if ((index + 1) == userModel.effort_lv)
        {
            benji.text = Tools.GetMessageById("23002");
            if (isUP)
            {
                dangqian.text = Tools.GetMessageById("23004");
            }
            else
            {
                dangqian.text = Tools.GetMessageById("23005");
            }
//			dangqianImg.visible = true;
        }
        else
        {
            benji.text    = Tools.GetMessageById("23003", new object[] { (index + 1) });
            dangqian.text = "";
//			dangqianImg.visible = false;
        }



        string     iii = Tools.GetEffortBuildID("0" + (index + 1));
        GameObject asd = EffectManager.inst.AddEffect(iii, iii, jianzhu.GetChild("n2").asGraph, null, false, 50, null, true);

        asd.transform.localScale *= 0.9f;
//        Debug.Log(asd.transform.localScale);
        if (userModel.effort_lv < (index + 1))
        {
            EffectManager.inst.SetShaderSaturation(asd, -1);
            EffectManager.inst.StopAnimation(asd);
        }
        list.itemRenderer = (int _index, GObject _ggo) =>
        {
            GObject _go = _ggo.asCom.GetChild("n0");
            _go.data = _go.x;
            if (donghuaXX && index == beforeEff_Lv - 1)
            {
                _go.alpha = 0;
                TimerManager.inst.Add(2f, 1, (float time) =>
                {
                    float hh = 0;
                    DOTween.To(() => hh, x => hh = x, 1f, 0.6f + (4f - (_index) % 4f) / 10f).OnUpdate(() =>
                    {
                        _go.alpha = hh;
                    }).OnComplete(() =>
                    {
                        if ((list.numItems - 1) == _index && beforeEff_Lv == 2)
                        {
                            if (GuideManager.inst.Check("100:2"))
                            {
                                GuideManager.inst.Show(this);
                                GuideManager.inst.onClick = OnClick;
                                donghuaXX = false;
                            }
                            else
                            {
                                this.touchable = true;
                            }
                        }
                        else
                        {
                            if (beforeEff_Lv != 2)
                            {
                                this.touchable = true;
                                donghuaXX      = false;
                            }
                        }
                    });
                    _go.x -= (4 - (_index) % 4) * 30 + 100;
                    _go.TweenMoveX(Convert.ToSingle(go.data), 0.8f).OnComplete(() =>
                    {
                        _go.x = Convert.ToSingle(go.data);
                    });
                });
            }
            else
            {
                _go.x = Convert.ToSingle(go.data);
                if (!donghuaXX)
                {
                    this.touchable = true;
                }
            }
            GComponent iconBtn = _go.asCom;
            string     dic     = ((Dictionary <string, object>)(((List <object>)lisXXda [index]) [_index])) ["id"].ToString();
            (_go as ComCard).SetData(dic, -1, 4);
            (_go as ComCard).SetText(Tools.GetMessageById(((Dictionary <string, object>)(((List <object>)lisXXda [index]) [_index])) ["name"].ToString()));
            iconBtn.RemoveEventListeners();
            iconBtn.onClick.Add(() =>
            {
                MediatorItemShipInfo2.CID = dic;
                ViewManager.inst.ShowView <MediatorItemShipInfo2> (true);
            });
        };

        if (((List <object>)lisXXda [index]) == null)
        {
            list.numItems = 0;
        }
        else
        {
            Tools.Sort(((List <object>)lisXXda [index]), new string[] { "index:int:0" });
            list.numItems = ((List <object>)lisXXda [index]).Count;
        }
//		list.onClear.Add (()=>{
//			if(list == null)
//			{
//			}
//		});
//		int hang = list.numItems / 4 + (list.numItems % 4 == 0 ? 0 : 1);
//		if (hang < 3)
//		{
//			list.y = 151 + (196 / 2) * (3 - hang);
//		}
//		else
//		{
//			list.y = 177f;
//		}
        btn.RemoveEventListeners();
        btn.onClick.Add(() =>
        {
            MediatorEffortXX.curEffort = (index + 1);
            ViewManager.inst.ShowView <MediatorEffortXX> ();
        });
    }
 //Functions
 public override void OnClick(GButton caller)
 {
     this.menu.hide();
 }
Beispiel #26
0
    //Remove Callbacks of UI Components in LinkHolder, seem to be of no use?
    void RemoveHandler()
    {
        if (_HasRegistered)
        {
            GButton[]    gBtns;
            Button[]     buttons;
            Toggle[]     toggles;
            Scrollbar[]  scrollbars;
            InputField[] inputFields;
            Dropdown[]   dropDowns;

            GNewListBase[]    newLists;
            GNewTabList[]     newTabLists;
            GNewLayoutTable[] newLayoutTables;

            GWebView[]                     newWebViews;
            GDragablePageView[]            dragablePageViews;
            DG.Tweening.DOTweenAnimation[] newDOTAnims;

            GScrollWatcher[] scrollWatchers;
            GSlideButton[]   slideBtns;

            InteractableUIHolder holder = gameObject.GetComponent <InteractableUIHolder>();
            if (holder != null)
            {
                gBtns       = holder.GBtns;
                buttons     = holder.Buttons;
                toggles     = holder.Toggles;
                scrollbars  = holder.Scrollbars;
                inputFields = holder.InputFields;
                dropDowns   = holder.Dropdowns;

                //GNewUI
                newLists        = holder.NewLists;
                newTabLists     = holder.NewTabLists;
                newLayoutTables = holder.NewLayoutTables;

                newWebViews       = holder.newWebViews;
                dragablePageViews = holder.dragablePageViews;
                newDOTAnims       = holder.newDOTAnims;
                scrollWatchers    = holder.ScrollDrags;
                slideBtns         = holder.SlideButtons;
            }
            else
            {
                gBtns       = gameObject.GetComponentsInChildren <GButton>(true);
                buttons     = gameObject.GetComponentsInChildren <Button>(true);
                toggles     = gameObject.GetComponentsInChildren <Toggle>(true);
                scrollbars  = gameObject.GetComponentsInChildren <Scrollbar>(true);
                inputFields = gameObject.GetComponentsInChildren <InputField>(true);
                dropDowns   = gameObject.GetComponentsInChildren <Dropdown>(true);

                //GNewUI
                newLists        = gameObject.GetComponentsInChildren <GNewListBase>(true);
                newTabLists     = gameObject.GetComponentsInChildren <GNewTabList>(true);
                newLayoutTables = gameObject.GetComponentsInChildren <GNewLayoutTable>(true);

                newWebViews       = gameObject.GetComponentsInChildren <GWebView>(true);
                dragablePageViews = gameObject.GetComponentsInChildren <GDragablePageView>(true);
                newDOTAnims       = gameObject.GetComponentsInChildren <DG.Tweening.DOTweenAnimation>(true);
                scrollWatchers    = gameObject.GetComponentsInChildren <GScrollWatcher>(true);
                slideBtns         = gameObject.GetComponentsInChildren <GSlideButton>(true);
            }

            for (int i = 0; i < gBtns.Length; i++)
            {
                GButton gbtn = gBtns[i];
                gbtn.OnClick = null;
                if (gbtn.IsProfessionModel)
                {
                    gbtn.PointerUpHandler          = null;
                    gbtn.PointerDownHandler        = null;
                    gbtn.OnPointerEnterHandler     = null;
                    gbtn.OnPointerExitHandler      = null;
                    gbtn.OnPointerLongPressHandler = null;
                }
            }

            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i].onClick.RemoveAllListeners();
            }

            for (int i = 0; i < toggles.Length; i++)
            {
                toggles[i].onValueChanged.RemoveAllListeners();
            }

            for (int i = 0; i < scrollbars.Length; i++)
            {
                scrollbars[i].onValueChanged.RemoveAllListeners();
            }

            for (int i = 0; i < inputFields.Length; i++)
            {
                inputFields[i].onEndEdit.RemoveAllListeners();
                inputFields[i].onValueChanged.RemoveAllListeners();
            }

            for (int i = 0; i < dropDowns.Length; i++)
            {
                GNewDropDown gndpd = dropDowns[i] as GNewDropDown;
                if (gndpd != null)
                {
                    gndpd.OnInitItem = null;
                }
                dropDowns[i].onValueChanged.RemoveAllListeners();
            }

            //NewUI
            for (int i = 0; i < newLists.Length; i++)
            {
                newLists[i].ClickItemCallBack       = null;
                newLists[i].LongPressCallBack       = null;
                newLists[i].InitItemCallBack        = null;
                newLists[i].ClickItemButtonCallBack = null;
            }

            for (int i = 0; i < newTabLists.Length; i++)
            {
                GNewTabList list = newTabLists[i];

                list.ClickItemCallBack              = null;
                list.InitItemCallBack               = null;
                list.ClickItemButtonCallBack        = null;
                list.ClickSubListItemButtonCallBack = null;
            }

            for (int i = 0; i < newLayoutTables.Length; i++)
            {
                GNewLayoutTable list = newLayoutTables[i];

                list.ClickItemCallBack       = null;
                list.InitItemCallBack        = null;
                list.ClickItemButtonCallBack = null;
            }

            for (int i = 0; i < newWebViews.Length; i++)
            {
                GWebView gwv = newWebViews[i];
                gwv.OnReceiveMessage = null;
            }

            for (int i = 0; i < dragablePageViews.Length; i++)
            {
                GDragablePageView gdv = dragablePageViews[i];
                gdv._PageItemInitCallBack        = null;
                gdv._ClickPageItemCallBack       = null;
                gdv._ClickPageItemButtonCallBack = null;
                gdv._PageItemIndexChangeCallBack = null;
            }

            for (int i = 0; i < newDOTAnims.Length; i++)
            {
                if (newDOTAnims[i].IsCallLuaOnComplete)
                {
                    newDOTAnims[i].OnComplete2Lua = null;
                }
            }

            for (int i = 0; i < scrollWatchers.Length; i++)
            {
                scrollWatchers[i].SetHandler(null);
            }

            for (int i = 0; i < slideBtns.Length; i++)
            {
                slideBtns[i].OnSlide = null;
            }
            _HasRegistered = false;
        }
    }
    public override void Init()
    {
        base.Init();
        string myUid = "";

        fightModel           = ModelManager.inst.fightModel;
        roleModel            = ModelManager.inst.roleModel;
        userModel            = ModelManager.inst.userModel;
        playbackfailure_time = (int)DataManager.inst.systemSimple["playbackfailure_time"];
        video_deadline       = (DateTime)DataManager.inst.systemSimple["video_deadline"];
        if (fightModel.isOpenFromRecord)
        {
            myUid            = roleModel.otherInfo["uid"].ToString();
            fightDataDetails = (object[])fightModel.fightDataDetails[fightModel.recordIndex];
            Create(Config.VIEW_FIGTHTDATASHOWMATCH, false, (string)roleModel.otherInfo["uname"] + Tools.GetMessageById("24224"));
        }
        else
        {
            myUid            = fightModel.myUid;
            fightDataDetails = (object[])fightModel.fightDataDetails;
            Create(Config.VIEW_FIGTHTDATASHOWMATCH, false, fightDataDetails[fightDataDetails.Length - 1].ToString() + Tools.GetMessageById("24224"));
        }
        GTextField text1 = this.GetChild("n5").asTextField;
        GTextField text2 = this.GetChild("n7").asTextField;
        GTextField text3 = this.GetChild("n4").asTextField;
        GTextField text4 = this.GetChild("n6").asTextField;

        timeFail = this.GetChild("n10").asTextField;
        GTextField value1 = this.GetChild("value1").asTextField;
        GTextField value2 = this.GetChild("value2").asTextField;
        GTextField value3 = this.GetChild("value3").asTextField;
        GTextField value4 = this.GetChild("value4").asTextField;

        list1    = this.GetChild("n3").asList;
        listData = new List <object[]>();

        share = this.GetChild("n9").asButton;
        watch = this.GetChild("n0").asButton;
        bool ok = userModel.GetUnlcok(Config.UNLOCK_FIGHTSHARE, share);

        if (!ok)
        {
            watch.x = 377;
        }
        //share.visible = true;
        share.text = Tools.GetMessageById("24219");
        //share.asCom.GetChild("n1").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_you1");
        share.RemoveEventListeners();
        share.onClick.Add(ShareOnclick);

        watch.text = Tools.GetMessageById("24248");
        //watch.asCom.GetChild("n1").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_you2");
        watch.RemoveEventListeners();
        watch.onClick.Add(WatchOnclick);

        if (fightModel.isOpenFromRecord)
        {
            if (!myUid.Equals(userModel.uid))
            {
                share.visible = false;
                watch.visible = false;
            }
            else
            {
                if (!TimeFail())
                {
                    share.visible    = false;
                    watch.visible    = false;
                    timeFail.visible = true;
                    timeFail.text    = Tools.GetMessageById("10038");
                }
            }
        }
        else
        {
            share.visible = false;
        }

        object[] dataAll = (object[])fightDataDetails[3];
        for (int i = 0; i < dataAll.Length; i++)
        {
            object[] data = (object[])dataAll[i];
            if (data[0].ToString().Equals(myUid))
            {
                dataMe = (object[])data[5];
            }
            listData.Add(data);
        }
        string str1   = Tools.GetMessageById("24231") + ":";
        string str1_1 = dataMe[0].ToString();
        string str2   = Tools.GetMessageById("24213") + ":";
        string str2_1 = dataMe[3].ToString();
        string str3   = Tools.GetMessageById("24211") + ":";
        string str3_1 = dataMe[1].ToString();
        string str4   = Tools.GetMessageById("24212") + ":";
        string str4_1 = dataMe[2].ToString();

        text1.text         = str1;
        text2.text         = str2;
        text3.text         = str3;
        text4.text         = str4;
        value1.text        = str1_1;
        value2.text        = str2_1;
        value3.text        = str3_1;
        value4.text        = str4_1;
        list1.itemRenderer = OnRander;
        list1.numItems     = listData.Count;
    }
Beispiel #28
0
    //This overrides the callback of a UI Component to a single call
    public void RegisterSingleObjHandler(GameObject control, int class_type, bool recursion)
    {
        if (control == null)
        {
            Debug.LogError("Cannot register event since the control object is null!");
            return;
        }

        System.Type type = WrapClassID.GetClassType(class_type);

        if (type == typeof(UnityEngine.UI.Button) || type == typeof(GButton))
        {
            GButton gbtn = control.GetComponent <GButton>();
            if (gbtn != null)
            {
                gbtn.OnClick = OnClick;
                return;
            }

            Button btn = control.GetComponent <Button>();
            if (btn != null)
            {
                btn.onClick.RemoveAllListeners();
                btn.onClick.AddListener(delegate() { OnClick(btn.gameObject); });
            }
            if (recursion)
            {
                GButton[] btns = control.GetComponentsInChildren <GButton>(true);
                for (int i = 0; i < btns.Length; i++)
                {
                    if (btns[i] != null)
                    {
                        btns[i].OnClick = OnClick;
                    }
                }
            }
        }
        else if (type == typeof(Toggle))
        {
            if (recursion)
            {
                Toggle[] toggles = control.GetComponentsInChildren <Toggle>(true);
                for (int i = 0; i < toggles.Length; i++)
                {
                    if (toggles[i] != null)
                    {
                        toggles[i].onValueChanged.RemoveAllListeners();
                        GameObject go = toggles[i].gameObject;
                        toggles[i].onValueChanged.AddListener(delegate(bool ischeck) { OnToggle(go, ischeck); });
                    }
                }
            }
            else
            {
                Toggle toggle = control.GetComponent <Toggle>();
                if (toggle != null)
                {
                    toggle.onValueChanged.RemoveAllListeners();
                    toggle.onValueChanged.AddListener(delegate(bool ischeck) { OnToggle(toggle.gameObject, ischeck); });
                }
            }
        }
        else if (type == typeof(GNewIOSToggle))
        {
            GNewIOSToggle gTgl = control.GetComponent <GNewIOSToggle>();
            if (gTgl != null)
            {
                gTgl.OnClick = OnClick;
                //gTgl.OnValueChanged = OnToggleSpecial;
            }
            if (recursion)
            {
                GNewIOSToggle[] gToggles = control.GetComponentsInChildren <GNewIOSToggle>(true);
                for (int i = 0; i < gToggles.Length; i++)
                {
                    if (gToggles[i] != null)
                    {
                        gToggles[i].OnClick = OnClick;
                        //gToggles[i].OnValueChanged = OnToggleSpecial;
                    }
                }
            }
        }
        else if (type == typeof(GText))
        {
            // 现在需求中GText不在root上,所以这么处理;其实不太好
            GText gtext = control.GetComponentInChildren <GText>();
            if (gtext != null)
            {
                gtext.OnClick = OnGTextClick;
            }
            if (recursion)
            {
                GText[] gts = control.GetComponentsInChildren <GText>(true);
                for (int i = 0; i < gts.Length; i++)
                {
                    if (gts[i] != null)
                    {
                        gts[i].OnClick = OnGTextClick;
                    }
                }
            }
        }
        else if (type == typeof(GImageModel))
        {
            GImageModel gim = control.GetComponent <GImageModel>();
            if (gim != null)
            {
                gim.OnModelClick = OnClick;
            }
            if (recursion)
            {
                GImageModel[] gims = control.GetComponentsInChildren <GImageModel>(true);
                for (int i = 0; i < gims.Length; i++)
                {
                    if (gims[i] != null)
                    {
                        gims[i].OnModelClick = OnClick;
                    }
                }
            }
        }
        else if (type == typeof(Slider))
        {
            Slider sld = control.GetComponent <Slider>();
            if (sld != null)
            {
                sld.onValueChanged.AddListener(delegate(float value) { OnSliderChanged(sld.gameObject, value); });
            }
            if (recursion)
            {
                Slider[] sliders = control.GetComponentsInChildren <Slider>(true);
                for (int i = 0; i < sliders.Length; i++)
                {
                    if (sliders[i] != null)
                    {
                        sliders[i].onValueChanged.AddListener(delegate(float value) { OnSliderChanged(sliders[i].gameObject, value); });
                    }
                }
            }
        }
        else if (type == typeof(GScaleScroll))
        {
            GScaleScroll gss = control.GetComponent <GScaleScroll>();
            if (gss != null)
            {
                gss.onScaleChanged = OnScaleChanged;
            }
            if (recursion)
            {
                GScaleScroll[] gsss = control.GetComponentsInChildren <GScaleScroll>(true);
                for (int i = 0; i < gsss.Length; i++)
                {
                    if (gsss[i] != null)
                    {
                        gsss[i].onScaleChanged = OnScaleChanged;
                    }
                }
            }
        }
        else if (type == typeof(GBlood))
        {
            GBlood gwv = control.GetComponent <GBlood>();
            if (gwv != null)
            {
                gwv.OnTweenFinishCallBack = this.OnDOTComplete;
            }
            if (recursion)
            {
                GBlood[] gwvs = control.GetComponentsInChildren <GBlood>(true);
                for (int i = 0; i < gwvs.Length; i++)
                {
                    gwvs[i].OnTweenFinishCallBack = this.OnDOTComplete;
                }
            }
        }
        else if (type == typeof(GWebView))
        {
            GWebView gwv = control.GetComponent <GWebView>();
            if (gwv != null)
            {
                gwv.OnReceiveMessage = this.OnReceiveWebViewMessage;
            }
            if (recursion)
            {
                GWebView[] gwvs = control.GetComponentsInChildren <GWebView>(true);
                for (int i = 0; i < gwvs.Length; i++)
                {
                    gwvs[i].OnReceiveMessage = OnReceiveWebViewMessage;
                }
            }
        }
        else if (type == typeof(GNewListBase))
        {
            GNewListBase list = control.GetComponent <GNewListBase>();
            if (list != null)
            {
                list.ClickItemCallBack = this.OnSelectItem;
                //list.PressItemCallBack = this.OnPressItem;
                //list.ReleaseItemCallBack = this.OnReleaseItem;
                list.LongPressCallBack = this.OnLongPressItem;
                list.InitItemCallBack  = this.OnInitItem;

                if (list.HasChildButton)
                {
                    list.ClickItemButtonCallBack = this.OnSelectItemButton;
                }
            }
            if (recursion)
            {
                GNewListBase[] lists = control.GetComponentsInChildren <GNewListBase>(true);
                for (int i = 0; i < lists.Length; i++)
                {
                    lists[i].ClickItemCallBack = this.OnSelectItem;
                    lists[i].LongPressCallBack = this.OnLongPressItem;
                    lists[i].InitItemCallBack  = this.OnInitItem;
                    if (lists[i].HasChildButton)
                    {
                        lists[i].ClickItemButtonCallBack = this.OnSelectItemButton;
                    }
                }
            }
        }
        else
        {
            // TODO: 将来根据需要自行扩展
            HobaDebuger.LogError("<RegisterUIEventHandler>WrapClassID not supported!" + class_type);
        }
    }
Beispiel #29
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="index"></param>
    /// <returns></returns>
    public string GetItemName(int index)
    {
        GButton item = _list.GetChildAt(index).asButton;

        return(item.name);
    }
Beispiel #30
0
    //[NoToLua]
    //[ContextMenu("ClearLuaHandlerLink")]
    //public void ClearLuaHandlerLink()
    //{
    //    _LuaPanelObject = null;
    //}


    //Add Callbacks to UI Components in LinkHolder
    public void RegisterHandler()
    {
        if (!_HasRegistered)
        {
            GButton[]    gBtns;
            Button[]     buttons;
            Toggle[]     toggles;
            Scrollbar[]  scrollbars;
            InputField[] inputFields;
            Dropdown[]   dropDowns;

            GNewListBase[]    newLists;
            GNewTabList[]     newTabLists;
            GNewLayoutTable[] newLayoutTables;

            //GUIAnim[] newUIAnims;
            GWebView[]                     newWebViews;
            GDragablePageView[]            dragablePageViews;
            DG.Tweening.DOTweenAnimation[] newDOTAnims;

            GScrollWatcher[] scrollWatchers;
            GSlideButton[]   slideBtns;

            InteractableUIHolder holder = gameObject.GetComponent <InteractableUIHolder>();
            if (holder != null)
            {
                gBtns       = holder.GBtns;
                buttons     = holder.Buttons;
                toggles     = holder.Toggles;
                scrollbars  = holder.Scrollbars;
                inputFields = holder.InputFields;
                dropDowns   = holder.Dropdowns;

                //GNewUI
                newLists        = holder.NewLists;
                newTabLists     = holder.NewTabLists;
                newLayoutTables = holder.NewLayoutTables;
                //newUIAnims = holder.newUIAnims;
                newWebViews       = holder.newWebViews;
                dragablePageViews = holder.dragablePageViews;
                //DOT
                newDOTAnims    = holder.newDOTAnims;
                scrollWatchers = holder.ScrollDrags;
                slideBtns      = holder.SlideButtons;
            }
            else
            {
                gBtns       = gameObject.GetComponentsInChildren <GButton>(true);
                buttons     = gameObject.GetComponentsInChildren <Button>(true);
                toggles     = gameObject.GetComponentsInChildren <Toggle>(true);
                scrollbars  = gameObject.GetComponentsInChildren <Scrollbar>(true);
                inputFields = gameObject.GetComponentsInChildren <InputField>(true);
                dropDowns   = gameObject.GetComponentsInChildren <Dropdown>(true);

                //GNewUI
                newLists        = gameObject.GetComponentsInChildren <GNewListBase>(true);
                newTabLists     = gameObject.GetComponentsInChildren <GNewTabList>(true);
                newLayoutTables = gameObject.GetComponentsInChildren <GNewLayoutTable>(true);
                //newUIAnims = gameObject.GetComponentsInChildren<GUIAnim>(true);
                newWebViews       = gameObject.GetComponentsInChildren <GWebView>(true);
                dragablePageViews = gameObject.GetComponentsInChildren <GDragablePageView>(true);

                newDOTAnims    = gameObject.GetComponentsInChildren <DG.Tweening.DOTweenAnimation>(true);
                scrollWatchers = gameObject.GetComponentsInChildren <GScrollWatcher>(true);
                slideBtns      = gameObject.GetComponentsInChildren <GSlideButton>(true);
            }

            for (int i = 0; i < gBtns.Length; i++)
            {
                GButton gbtn = gBtns[i];
                gbtn.OnClick = OnClick;
                if (gbtn.IsProfessionModel)
                {
                    gbtn.PointerUpHandler = go =>
                    {
                        //Debug.LogWarning("OnPointerUp");
                        CallPanelFunc("OnPointerUp", go.name);
                    };
                    gbtn.PointerDownHandler = go =>
                    {
                        //Debug.LogWarning("OnPointerDown");
                        CallPanelFunc("OnPointerDown", go.name);
                    };
                    gbtn.OnPointerEnterHandler = go =>
                    {
                        CallPanelFunc("OnPointerEnter", go.name);
                    };
                    gbtn.OnPointerExitHandler = go =>
                    {
                        CallPanelFunc("OnPointerExit", go.name);
                    };

                    gbtn.OnPointerLongPressHandler = go =>
                    {
                        CallPanelFunc("OnPointerLongPress", go.name);
                    };
                }
            }

            for (int i = 0; i < buttons.Length; i++)
            {
                Button btn = buttons[i];
                btn.onClick.RemoveAllListeners();
                btn.onClick.AddListener(delegate() { OnClick(btn.gameObject); });
            }

            for (int i = 0; i < toggles.Length; i++)
            {
                Toggle toggle = toggles[i];
                toggle.onValueChanged.RemoveAllListeners();
                toggle.onValueChanged.AddListener(delegate(bool ischeck) { OnToggle(toggle.gameObject, ischeck); });

                GNewBtnExpress btx = toggle.GetComponent <GNewBtnExpress>();
                if (btx)
                {
                    btx.RegisterToToggle(toggle);
                }
            }

            for (int i = 0; i < scrollbars.Length; i++)
            {
                Scrollbar scrollbar = scrollbars[i];
                scrollbar.onValueChanged.RemoveAllListeners();
                scrollbar.onValueChanged.AddListener(delegate(float value) { OnScroll(scrollbar.gameObject, value); });
            }

            for (int i = 0; i < inputFields.Length; i++)
            {
                InputField inputField = inputFields[i];
                inputField.onEndEdit.RemoveAllListeners();
                inputField.onValueChanged.RemoveAllListeners();
                inputField.onEndEdit.AddListener(delegate(string str) { OnEndEdit(inputField.gameObject, str); });

                //try to cut out emoji
                if (inputField.contentType == InputField.ContentType.Standard)
                {
                    inputField.onValidateInput = OnValidInputdelegate;
                }

                //inputField.onValueChanged.AddListener(delegate(string str)
                //{
                //    string str_new = Regex.Replace(str, @"\p{Cs}", ""); //屏蔽emoji
                //    if (string.CompareOrdinal(str, str_new) != 0)
                //    {
                //        inputField.text = str_new;
                //    }
                //});
                inputField.onValueChanged.AddListener(delegate(string str) { OnValueChanged(inputField.gameObject, str); });
            }

            for (int i = 0; i < dropDowns.Length; i++)
            {
                Dropdown dpd = dropDowns[i];

                GNewDropDown gndpd = dpd as GNewDropDown;
                if (gndpd != null)
                {
                    gndpd.OnInitItem = this.OnInitItem;
                }

                dpd.onValueChanged.RemoveAllListeners();
                dpd.onValueChanged.AddListener(index => { OnDropDown(dpd.gameObject, index); });
            }

            //NewUI
            for (int i = 0; i < newLists.Length; i++)
            {
                GNewListBase list = newLists[i];

                list.ClickItemCallBack = this.OnSelectItem;
                //list.PressItemCallBack = this.OnPressItem;
                //list.ReleaseItemCallBack = this.OnReleaseItem;
                list.LongPressCallBack = this.OnLongPressItem;
                list.InitItemCallBack  = this.OnInitItem;

                if (list.HasChildButton)
                {
                    list.ClickItemButtonCallBack = this.OnSelectItemButton;
                }
            }

            for (int i = 0; i < newTabLists.Length; i++)
            {
                GNewTabList list = newTabLists[i];

                list.ClickItemCallBack = this.OnTabListSelectItem;
                list.InitItemCallBack  = this.OnTabListInitItem;
                if (list.HasChildButton)
                {
                    list.ClickItemButtonCallBack = this.OnSelectItemButton;
                }
                list.ClickSubListItemButtonCallBack = this.OnTabSubListItemButton;
            }

            for (int i = 0; i < newLayoutTables.Length; i++)
            {
                GNewLayoutTable list = newLayoutTables[i];

                list.ClickItemCallBack = this.OnSelectItem;
                list.InitItemCallBack  = this.OnInitItem;
                if (list.HasChildButton)
                {
                    list.ClickItemButtonCallBack = this.OnSelectItemButton;
                }
            }

            for (int i = 0; i < newWebViews.Length; i++)
            {
                GWebView gwv = newWebViews[i];
                gwv.OnReceiveMessage = this.OnReceiveWebViewMessage;
            }

            for (int i = 0; i < dragablePageViews.Length; i++)
            {
                GDragablePageView gdv = dragablePageViews[i];
                gdv._PageItemInitCallBack        = this.OnInitItem;
                gdv._ClickPageItemCallBack       = this.OnSelectItem;
                gdv._ClickPageItemButtonCallBack = this.OnSelectItemButton;
                gdv._PageItemIndexChangeCallBack = this.OnDragablePageIndexChange;
            }

            for (int i = 0; i < newDOTAnims.Length; i++)
            {
                if (newDOTAnims[i].IsCallLuaOnComplete)
                {
                    newDOTAnims[i].OnComplete2Lua = this.OnDOTComplete;
                }
            }

            for (int i = 0; i < scrollWatchers.Length; i++)
            {
                scrollWatchers[i].SetHandler(OnScrollWithoutFocus);
            }

            for (int i = 0; i < slideBtns.Length; i++)
            {
                slideBtns[i].OnSlide = this.OnButtonSlide;
            }

            _PanelName = this.name;
            Schedule.SetTag(_PanelName);

            _HasRegistered = true;
        }
    }
Beispiel #31
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="name"></param>
    /// <param name="grayed"></param>
    public void SetItemGrayed(string name, bool grayed)
    {
        GButton item = _list.GetChild(name).asButton;

        item.grayed = grayed;
    }
Beispiel #32
0
        public override void ConstructFromXML(XML xml)
        {
            base.ConstructFromXML(xml);

            btnStart = (GButton)this.GetChild("btnStart");
        }
Beispiel #33
0
    void RenderListItem2(int index, GObject obj)
    {
        GButton item = obj.asButton;

        item.title = "Item " + index;
    }
 public override void OnClick(GButton caller)
 {
     this.input.OnClick();
 }
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_EFFORTXX, false, Tools.GetEffortName((curEffort)));

        userModel = ModelManager.inst.userModel;

        qqbox1 = this.GetChild("n10").asCom;
        qqbox2 = this.GetChild("n11").asCom;
        gybox1 = this.GetChild("n8").asCom;
        gybox2 = this.GetChild("n9").asCom;
//		title = view.GetChild ("n2").asTextField;

        Dictionary <string, object> _data       = userModel.GetCardRequestRarityAndCount(curEffort);
        Dictionary <string, object> cfg_Explore = DataManager.inst.explore;

        List <object> lis = Tools.ConvertDicToList(_data, "id");

        Tools.Sort(lis, new string[] { "id:int:0" });

        Dictionary <string, object> fafaf = (Dictionary <string, object>)lis [0];

        qqbox1.GetChild("n0").asLoader.url     = Tools.GetResourceUrl("Image:icon_kp" + Convert.ToString(Convert.ToInt16(fafaf["id"]) + 1));
        gybox1.GetChild("n0").asLoader.url     = Tools.GetResourceUrl("Image:icon_kp" + Convert.ToString(Convert.ToInt16(fafaf["id"]) + 1));
        qqbox1.GetChild("n2").asTextField.text = fafaf ["num"].ToString();
        gybox1.GetChild("n2").asTextField.text = fafaf ["sup_num"].ToString();
        fafaf = (Dictionary <string, object>)lis [1];
        qqbox2.GetChild("n0").asLoader.url     = Tools.GetResourceUrl("Image:icon_kp" + Convert.ToString(Convert.ToInt16(fafaf["id"]) + 1));
        gybox2.GetChild("n0").asLoader.url     = Tools.GetResourceUrl("Image:icon_kp" + Convert.ToString(Convert.ToInt16(fafaf["id"]) + 1));
        qqbox2.GetChild("n2").asTextField.text = fafaf ["num"].ToString();
        gybox2.GetChild("n2").asTextField.text = fafaf ["sup_num"].ToString();

//		title.text = Tools.GetEffortName ((curEffort));
//		this.GetChild ("n3").asTextField.text = Tools.GetMessageById ("23008");
        this.GetChild("n19").asTextField.text = Tools.GetMessageById("23009");
        this.GetChild("n20").asTextField.text = Tools.GetMessageById("23010");
        this.GetChild("n21").asTextField.text = Tools.GetMessageById("23011");
        this.GetChild("n22").asTextField.text = Tools.GetMessageById("23011");

        boxList = new List <GButton> ();
        int           index = 1;
        List <object> list  = new List <object> ();

        foreach (string j in ((Dictionary <string, object>)cfg_Explore["box"]).Keys)
        {
            if (j.IndexOf("R") != -1)
            {
                Dictionary <string, object> dicto = new Dictionary <string, object> ();
                dicto.Add("id", j);
                list.Add(dicto);
            }
        }
        Tools.Sort(list, new string[] { "id:string:0" });
        for (int i = 0; i < list.Count; i++)
        {
            Dictionary <string, object> dic = ((Dictionary <string, object>)cfg_Explore ["box"]) [((Dictionary <string, object>)list[i])["id"].ToString()] as Dictionary <string, object>;
            GComponent com  = this.GetChild("b" + index).asCom;
            GButton    btn  = com.asButton;
            GGraph     icon = com.GetChild("n2").asGraph;
            GTextField num  = com.GetChild("n3").asTextField;

            Dictionary <string, object> curReward = (Dictionary <string, object>)DataManager.inst.award [dic ["reward"].ToString()];
            float[] numArr = Tools.NumSection((object[])((Dictionary <string, object>)curReward ["card"])["num"], MediatorEffortXX.curEffort);
            num.text = Tools.GetMessageById("14016", new object[] { Math.Floor(numArr [0]) + "" });
            string boxname = Tools.GetExploreBoxID(((Dictionary <string, object>)(((Dictionary <string, object>)cfg_Explore ["box"]) [((Dictionary <string, object>)list [i]) ["id"].ToString()])) ["icon"].ToString());
//			GameObjectScaler.Scale (EffectManager.inst.AddEffect (boxname,boxname, icon,null,true,50,null,true), 0.4f);
            EffectManager.inst.AddEffect(boxname, boxname, icon, null, true, 50, null, true).transform.localScale *= 0.4f;
            //				EffectManager.inst.AddPrefab (Tools.GetExploreBoxID (((Dictionary<string,object>)(((Dictionary<string,object>)cfg_Explore ["box"]) [j])) ["icon"].ToString ()), icon).transform.localScale *= 0.4f;
//			btn.name = index.ToString();
            btn.data = ((Dictionary <string, object>)list[i])["id"].ToString();
            boxList.Add(btn);
            btn.RemoveEventListeners();
            btn.onTouchBegin.Add((EventContext ev) => {
                if (item != null)
                {
                    this.RemoveChild(item.group, true);
                }
                MediatorExploreBox.eid = btn.data.ToString();
                item         = new MediatorExploreBox();
                item.group.x = (ev.sender as GButton).x - 20;
                item.group.y = (ev.sender as GButton).y;
                item.ChangY();
                if (item.y < -100)
                {
                    item.y = -100;
                }
                this.AddChild(item.group);
            });
            btn.onTouchEnd.Add(() => {
                if (item != null)
                {
                    this.RemoveChild(item.group, true);
                }
            });
            index++;
        }

//		view.GetChild ("n24").asButton.onClick.Add (() => {
//			ViewManager.inst.CloseView(this);
//		});
    }
 //Functions
 public override void OnClick(GButton caller)
 {
     this.close.SetActive(false);
 }
Beispiel #37
0
 public override void OnClick(GButton caller)
 {
     this.tabs.OnActive(this);
 }
Beispiel #38
0
        void onBtnTimesClick(EventContext e)
        {
            GButton btn = e.sender as GButton;

            Api.Game.SetTimes(Data.Game.Id, int.Parse(btn.data + ""));
        }
Beispiel #39
0
        void onScore(EventContext e)
        {
            GButton btn = e.sender as GButton;

            Api.Game.SetScore(Data.Game.Id, int.Parse(btn.title));
        }
Beispiel #40
0
 //Abstract functions
 public abstract void OnClick(GButton caller);