private void OnRender_1(int index, GObject item)
    {
        object[] data = (object[])listData1[index];

        GComponent obj  = item.asCom;
        GButton    head = obj.GetChild("n0").asCom.GetChild("n0").asButton;

        obj.GetChild("n0").asCom.GetChild("n2").text = data[2].ToString();
        if (Tools.IsNullEmpty(data[1]))
        {
            obj.GetChild("n2").asTextField.text = data[0].ToString();
        }
        else
        {
            obj.GetChild("n2").asTextField.text = data[1].ToString();
        }
        if ((int)data[0] > 0)
        {
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)data[9])["use"].ToString()));
        }
        else
        {
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(data[1].ToString(), false, true));
        }
        //Tools.SetLoaderButtonUrl(obj.GetChild("n0").asCom.GetChild("n0").asButton, ModelUser.GetHeadUrl(((Dictionary<string, object>)data[9])["use"].ToString()));
        obj.GetChild("n3").asButton.onClick.Add(() => {
            fightModel.openIndex = index.ToString();
            ViewManager.inst.ShowView <MediatorFightDataShowMember>();
        });
    }
Ejemplo n.º 2
0
    public void SetData(Dictionary <string, object> data)
    {
        this.data = data;
        if (data ["type"].ToString() == "0")
        {
            this.GetChild("n1").text = Tools.GetMessageById("25006", new String[] { ModelUser.GetUname(data ["uid"], data ["name"]) });
        }
        else
        {
            this.GetChild("n1").text = Tools.GetMessageById("25040", new String[] { ModelUser.GetUname(data ["uid"], data ["name"]) });
        }
        this.GetChild("n2").text = ModelUser.GetUname(data ["uid"], data ["name"]);
        GButton head = this.GetChild("n3").asButton;

        head.GetChild("n2").text = data ["lv"].ToString();
        Tools.SetLoaderButtonUrl(head.GetChild("n0").asButton, ModelUser.GetHeadUrl(Tools.Analysis(data, "head.use").ToString()));

        GButton btn1 = this.GetChild("n4").asButton;

        btn1.text = Tools.GetMessageById("14056");
        GButton btn2 = this.GetChild("n5").asButton;

        btn2.text = Tools.GetMessageById("14057");
        btn1.onClick.Add(Btn1_Click);
        btn2.onClick.Add(Btn2_Click);
    }
Ejemplo n.º 3
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.COM_GOLDCOINEXP, true);
        this.width = GRoot.inst.width;

        userModel = ModelManager.inst.userModel;
        exp       = this.GetChild("n54").asProgress;
        gold      = this.GetChild("n2").asCom;
        coin      = this.GetChild("n1").asCom;

        name           = this.GetChild("n3").asTextField;
        lv             = this.GetChild("n12").asCom.GetChild("n2").asTextField;
        head           = this.GetChild("n12").asCom.GetChild("n0").asButton;
        head.touchable = false;
//		bar = view.GetChild ("n54") as ComProgressBar;

//		exp.skin = ComProgressBar.BAR8;
        exp.GetChild("bar").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shengji2");
        exp.value = userModel.exp;
        exp.max   = userModel.GetExpMax(userModel.lv);
        name.text = userModel.uname;
        lv.text   = userModel.lv.ToString();
        Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(userModel.head ["use"].ToString()));

        TimerManager.inst.Add(1f, 0, Over);
        this.AddGlobalListener(MainEvent.JUMP_COINGOLDEXPGET, Onfunction);
    }
Ejemplo n.º 4
0
    private void List_Render(int index, GObject item)
    {
        GButton obj = item.asCom.GetChild("n0").asButton;
        GImage  bg  = item.asCom.GetChild("n1").asImage;

        bg.visible = false;
        Dictionary <string, object> dc = (Dictionary <string, object>)list[index];
        string uid = dc["uid"] + "";

        if (uid.Equals(userModel.uid))
        {
            bg.visible = true;
        }
        string dc1 = (string)(dc["head_use"]);

        Tools.SetLoaderButtonUrl(obj, ModelUser.GetHeadUrl(dc1));
        obj.RemoveEventListeners();
        obj.onClick.Add(() =>
        {
            if (!uid.Equals(userModel.uid))
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] {
                    otherInfo ["uid"].ToString(),
                    dc ["uid"].ToString(),
                    roleModel.tab_Role_CurSelect1,
                    roleModel.tab_Role_CurSelect2,
                    roleModel.tab_Role_CurSelect3
                }));
            }
            else
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
            }
        });
    }
Ejemplo n.º 5
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_TIP, false, Tools.GetMessageById("24245"));


        userModel = ModelManager.inst.userModel;
        cfg       = (Dictionary <string, object>)DataManager.inst.match ["custom_level"];
        head      = this.GetChild("n8").asCom;

        head.GetChild("n2").text = cfg ["ship"].ToString();
        Tools.SetLoaderButtonUrl(head.GetChild("n0").asButton, ModelUser.GetHeadUrl(userModel.head ["use"].ToString()));
        this.GetChild("n4").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image:icon_kp1");
        this.GetChild("n5").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image:icon_kp2");
        this.GetChild("n6").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image:icon_kp3");
        this.GetChild("n7").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image:icon_kp4");

        this.GetChild("n4").asCom.GetChild("n1").asCom.GetChild("n1").asTextField.text = cfg ["0"].ToString();
        this.GetChild("n5").asCom.GetChild("n1").asCom.GetChild("n1").asTextField.text = cfg ["1"].ToString();
        this.GetChild("n6").asCom.GetChild("n1").asCom.GetChild("n1").asTextField.text = cfg ["2"].ToString();
        this.GetChild("n7").asCom.GetChild("n1").asCom.GetChild("n1").asTextField.text = cfg ["3"].ToString();

        this.GetChild("n10").asTextField.text = Tools.GetMessageById("25060");
        this.GetChild("n3").asTextField.text  = Tools.GetMessageById("25061");
    }
Ejemplo n.º 6
0
    private void Update_headimg(string img)
    {
        //

        //lht这里需要判断平台的 账号是否绑定过了,是否能用平台账号绑定
//        string param = "";
//        switch (Type_Bingding) {
//            case Ex_Local.LOGIN_TYPE_QQ:
//                param = "openid=" + LocalStore.QQ_OPENID;
//                param += "|token=" + LocalStore.QQ_TOKEN;
//                param += "|data=" + LocalStore.QQ_DATE;
//                break;
//            case Ex_Local.LOGIN_TYPE_WEIXIN:
//                param = "openid=" + LocalStore.WX_OPENID;
//                param += "|token=" + LocalStore.WX_TOKEN;
//                param += "|data=" + "";
//                break;
//        }
//        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_PWD, input_password.text);
        //LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text);
        //userModel.tel = input_phone.text;
        //otherInfo["tel"] = input_phone.text;
        //LocalStore.DelUids(userModel.uid);
        //LocalStore.SetUids(userModel.uname, input_password.text, Ex_Local.LOGIN_TYPE_UNAME);
        //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);

        Dictionary <string, object> data = new Dictionary <string, object>();

        data["head_key"] = img;
        NetHttp.inst.Send(NetBase.HTTP_CHOOSE_HEAD, data, (VoHttp vo) =>
        {
//                    userModel.type_login = Type_Bingding;
            userModel.UpdateData(vo.data);
            //
//                    LocalStore.SetLocal(LocalStore.LOCAL_TYPE, userModel.type_login);
            //
            Dictionary <string, object> headIcon = (Dictionary <string, object>)userModel.head;
            head_Icon = head.GetChild("n0").asCom.GetChild("n0").asLoader;
//                    head_Icon.url = ModelUser.GetHeadUrl(headIcon["use"].ToString());
            Tools.SetLoaderButtonUrl(null, ModelUser.GetHeadUrl(headIcon["use"].ToString()), head_Icon);

            LocalStore.SetLocal(LocalStore.OTHER_HEADIMG + userModel.uid, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG));
        });

//            }
//        });

        //
    }
Ejemplo n.º 7
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_LEVELUSERUP, true);
        ViewManager.SetWidthHeight(this.GetChild("n0"));
//		ViewManager.SetWidthHeight (this.GetChild ("n13"));
        userModel = ModelManager.inst.userModel;
        this.DispatchGlobalEvent(new MainEvent(MainEvent.LEVEL_UP_USER));
        Dictionary <string, object> cfg = (Dictionary <string, object>)((Dictionary <string, object>)((Dictionary <string, object>)DataManager.inst.beckon ["player"]) ["up"]) ["hp"];
        int hp = (int)((Dictionary <string, object>)((Dictionary <string, object>)DataManager.inst.beckon ["player"]) ["property"]) ["hp"];

        //		GameObjectScaler.Scale (EffectManager.inst.AddPrefab ("Player_lvup/player_lvup", this.GetChild ("n14").asGraph), 1.5f);
        GameObject go = EffectManager.inst.AddPrefab("Player_lvup/player_lvup", this.GetChild("n14").asGraph);

        go.transform.localScale *= 1.5f;

        go.GetComponent <AudioSource>().volume = userModel.isSound?1:0;

        this.GetChild("n0").asButton.onClick.Add(OnCloseViewFun);
        this.GetChild("n0").asButton.touchable = false;
        this.GetChild("n8").asCom.GetChild("n2").asTextField.text = userModel.lv.ToString();
        if (userModel.uname != null)
        {
            this.GetChild("n4").asTextField.text = userModel.uname;
        }
        else
        {
            this.GetChild("n4").asTextField.text = userModel.uid;
        }
        this.GetChild("n6").asTextField.text  = Tools.GetMessageById("24121");
        this.GetChild("n18").asTextField.text = userModel.lv.ToString();
        this.GetChild("n19").asTextField.text = Tools.GetMessageById("24135");
        this.GetChild("n10").asTextField.text = Tools.GetMessageById(cfg ["name"].ToString());

        GButton head = this.GetChild("n8").asCom.GetChild("n0").asButton;

        head.touchable = false;

        Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(userModel.head ["use"].ToString()));


        float zzz     = 0f;
        float shengji = 0f;

        zzz = Convert.ToSingle(Convert.ToSingle(hp) * Math.Pow(Convert.ToSingle(cfg ["power"]), Convert.ToSingle(oldLv - 1)) + Convert.ToSingle(cfg ["add"]) * Convert.ToSingle(oldLv - 1));
        if ((oldLv) == 1)
        {
            zzz = Convert.ToSingle(hp);
        }
        shengji = Convert.ToSingle(Convert.ToSingle(hp) * Math.Pow(Convert.ToSingle(cfg ["power"]), Convert.ToSingle(userModel.lv - 1)) + Convert.ToSingle(cfg ["add"]) * Convert.ToSingle(userModel.lv - 1) - zzz);
//		Log.debug (Math.Pow (Convert.ToSingle (cfg ["power"]), Convert.ToSingle (userModel.lv - 1)).ToString ());
//		Log.debug (Convert.ToSingle (cfg ["power"]) + "||||" + Convert.ToSingle (userModel.lv - 1));
        this.GetChild("n11").asTextField.text = string.Format("{0:F0}", zzz);
        this.GetChild("n17").asTextField.text = string.Format("+{0:F0}", shengji);
//		this.GetChild ("n11").asTextField.text = Math.Floor (zzz).ToString ();
//		this.GetChild ("n17").asTextField.text = "+" + Math.Floor (shengji).ToString ();
        TimerManager.inst.Add(1.5f, 1, OnCanClose);
    }
Ejemplo n.º 8
0
    private void OnRander(int index, GObject go)
    {
        Dictionary <string, object> _data = (Dictionary <string, object>)dic [index];

        go.asCom.GetController("c1").selectedIndex = (int)_data ["st"] == 0 ? 1 : 0;
        GComponent nm;
        GTextField txt;
        GTextField name;
        GTextField time;
        DateTime   times = (DateTime)_data["time"];
        GButton    head;

        if ((int)_data ["st"] == 0)
        {
            nm   = go.asCom.GetChild("n1").asCom;
            txt  = nm.GetChild("n2").asTextField;
            name = nm.GetChild("n1").asTextField;
            time = nm.GetChild("n4").asTextField;
            head = nm.GetChild("n0").asButton;

            name.text = userModel.GetUName();
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(userModel.head ["use"].ToString()));
            txt.text = _data ["content"].ToString();
        }
        else
        {
            nm   = go.asCom.GetChild("n0").asCom;
            txt  = nm.GetChild("n2").asTextField;
            name = nm.GetChild("n1").asTextField;
            time = nm.GetChild("n4").asTextField;
            head = nm.GetChild("n0").asButton;
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(DataManager.inst.systemSimple ["service_icon"].ToString(), true));
            txt.text  = _data ["content"].ToString().Split('|') [1];
            name.text = kefuName;
        }
        Tools.DataTimeFormat(time, times, 0);
        //		time.text = times.ToString ();
        //if (txt.textHeight > 31)
        //{
        //nm.GetChild("n5").height = 49;
        //float c = txt.textHeight - 31;
        //nm.GetChild("n5").height = nm.GetChild("n5").height + c;
        //go.height = (90 - 31) + txt.textHeight + 10;
        //			it.GetChild ("n4").y = it.GetChild ("n4").y + c;
        go.height = txt.y + txt.textHeight + 40 + 30;

        nm.GetChild("n5").height = txt.textHeight + 33;

        time.y = nm.GetChild("n5").y + nm.GetChild("n5").height + 10;
        //}
        //else
        //{
        //    go.height = 115 + 10;
        //    //			it.GetChild ("n4").y = 90;
        //}
    }
Ejemplo n.º 9
0
    private void ListRendere(int index, GObject item)
    {
        GButton head = item.asCom.GetChild("n3").asButton;
        GLoader bg   = item.asCom.GetChild("n0").asLoader;
        Dictionary <string, object> d = (Dictionary <string, object>)itemData[index];

        if (d["name"].ToString().Equals(userModel.head["use"].ToString()))
        {
            bg.url = Tools.GetResourceUrl("Image2:n_bg_touxiang2");
        }
        else
        {
        }
        Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl((string)d["name"]));
        head.RemoveEventListeners();
        head.onClick.Add(() =>
        {
//            if ((string)d["name"] == "h01")
//            {
//                return;
//            }
            //    if (!userModel.head["use"].ToString().Equals(d["name"]))
            //{
            Dictionary <string, object> data = new Dictionary <string, object>();
            data["head_key"] = d["name"];
            int statusInt    = Convert.ToInt32(d["status"]);
            if (statusInt == -1)
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13150"));
            }
//				else if(statusInt == -2){
//					ViewManager.inst.ShowText(Tools.GetMessageById("13154"));
//				}
            else
            {
                NetHttp.inst.Send(NetBase.HTTP_CHOOSE_HEAD, data, (VoHttp vo) =>
                {
                    userModel.UpdateData(vo.data);
                    Dictionary <string, object> dc = new Dictionary <string, object>();
                    dc.Add("value", d);
                    dc.Add("tag", "photo");
                    this.DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc));
                    ViewManager.inst.CloseView(this);
                });
            }
            //}
        });
    }
Ejemplo n.º 10
0
 public static void setHeadSprite(string name, Image image, string uid)
 {
     if (FightMain.fightTest)
     {
         return;
     }
     name = ModelUser.GetHeadUrl(name, false, uid.IndexOf("-") == 0, true);
     if (map.ContainsKey(name))
     {
         image.sprite = (Sprite)map[name];
     }
     else
     {
         Tools.SetLoaderButtonUrl(null, name, null, image, (sp) => {
             map[name] = image.sprite;
         });
     }
 }
    private void OnRender_2(int index, GObject item)
    {
        object[]   data = (object[])listData2[index];
        GComponent obj  = item.asCom;
        GButton    head = obj.GetChild("n0").asCom.GetChild("n0").asButton;

        obj.GetChild("n0").asCom.GetChild("n2").text = data[2].ToString();
        if (data[1] != null)
        {
            obj.GetChild("n2").asTextField.text = data[1].ToString();
        }
        else
        {
            obj.GetChild("n2").asTextField.text = data[0].ToString();
        }
        if ((int)data[0] > 0)
        {
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)data[9])["use"].ToString()));
        }
        else
        {
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(data[1].ToString(), false, true));
        }

        obj.GetChild("n3").asButton.RemoveEventListeners();
        obj.GetChild("n3").asButton.onClick.Add(() =>
        {
            string selecteIndex = "";
            for (int i = 0; i < dataAll.Length; i++)
            {
                object[] data1 = (object[])dataAll[i];
                if (data[0].ToString().Equals(data1[0].ToString()))
                {
                    selecteIndex = i.ToString();
                }
                listData.Add(data);
            }

            fightModel.openIndex = selecteIndex;
            ViewManager.inst.ShowView <MediatorFightDataShowMember>();
        });
    }
Ejemplo n.º 12
0
    private void ListRendere(int index, GObject item)
    {
        GButton    head = item.asCom.GetChild("n3").asButton;
        GTextField num  = item.asCom.GetChild("n2").asTextField;
        GImage     bg   = item.asCom.GetChild("n4").asImage;
        GTextField name = item.asCom.GetChild("n15").asTextField;
        Dictionary <string, object> d = (Dictionary <string, object>)roleLove[index];

        bg.visible = false;
        if (Tools.IsNullEmpty(d["uname"]))
        {
            name.text = d["uid"].ToString();
        }
        else
        {
            name.text = d["uname"].ToString();
        }
        if (d["uid"].ToString().Equals(userModel.uid))
        {
            bg.visible = true;
        }
        Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl((string)d["head_use"]));
        num.text = d["like_num"] + "";
        head.RemoveEventListeners();
        head.onClick.Add(() => {
            Dictionary <object, object> dc_ = new Dictionary <object, object>();
            dc_["fuid"] = d["uid"];
            string uid  = ModelManager.inst.userModel.uid;
            string fuid = dc_["fuid"] + "";
            if (!fuid.Equals(uid))
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { otherInfo["uid"].ToString(), dc_["fuid"].ToString(), roleModel.tab_Role_CurSelect1, roleModel.tab_Role_CurSelect2, roleModel.tab_Role_CurSelect3 }));
            }
            else
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
            }
        });
    }
Ejemplo n.º 13
0
 private void UpdatePhotoHead(GObject item, GImage g2, string name, int status_, int index)
 {
     content.visible = true;
     if (name == "")
     {
         bg.visible             = true;
         image_photo.visible    = false;
         del.visible            = false;
         image_photo_.touchable = false;
         image_.visible         = true;
     }
     else
     {
         if (tempTag != null)
         {
             //tempTag.asCom.GetChild ("n6").asImage.visible = true;
             tempTag.asCom.GetChild("n9").asImage.visible = false;
             tempTag = null;
         }
         g2.visible = true;
         tempTag    = item;
         //			image_photo.url = ModelUser.GetHeadUrl (smallNameToHDname (name));
         Tools.SetLoaderButtonUrl(null, ModelUser.GetHeadUrl(smallNameToHDname(name)), image_photo);
         image_photo.visible    = true;
         image_photo.name       = name;
         del.visible            = true;
         image_photo_.touchable = true;
         image_.visible         = false;
         if (!otherInfo["uid"].ToString().Equals(userModel.uid))
         {
             del.visible = false;
         }
     }
     StatusCurr = status_;
     CheckStatus(status_, content);
 }
Ejemplo n.º 14
0
    public override void Init()
    {
        Create(Config.VIEW_FIGTHTDATASHOWMEMBER /*,false,Tools.GetMessageById("24242")*/);
        fightModel = ModelManager.inst.fightModel;
        if (fightModel.isOpenFromRecord)
        {
            fightDataDetails = (object[])fightModel.fightDataDetails[fightModel.recordIndex];
        }
        else
        {
            fightDataDetails = (object[])fightModel.fightDataDetails;
        }

        roleModel = ModelManager.inst.roleModel;
        dataAll   = (object[])fightDataDetails[3];
        myData    = (object[])dataAll[Convert.ToInt32(fightModel.openIndex)];
        GComponent comPhoto     = this.GetChild("n2").asCom;
        GTextField uname        = this.GetChild("n3").asTextField;
        GTextField guildName    = this.GetChild("n4").asTextField;
        GComponent comScoreType = this.GetChild("n7").asCom;
        GLoader    scoreTypeBG  = comScoreType.GetChild("n1").asLoader;
        GTextField scoreTypeNum = comScoreType.GetChild("n4").asTextField;
        GGroup     group        = GetChild("n25").asGroup;

        GList   list           = this.GetChild("n22").asList;
        GButton dreamAttention = this.GetChild("n23").asButton;

        dreamAttention.text = Tools.GetMessageById("13147");
        dreamAttention.onClick.Add(() => {
            if ((int)myData[0] <= 0)
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("24228"));
            }
            else
            {
                Dictionary <string, object> data1 = new Dictionary <string, object>();
                data1["fuid"] = myData[0];
                NetHttp.inst.Send(NetBase.HTTP_FOLLOW, data1, (VoHttp vo) =>
                {
                    if ((bool)vo.data == true)
                    {
                        ModelRole.attentionFight.Add(myData[0].ToString());

                        //if ((int)fightDataDetails[0] == 1)
                        //{
                        //    myData[10] = true;
                        //}
                        //else
                        //{
                        //    myData[13] = true;
                        //}


                        ViewManager.inst.ShowText(Tools.GetMessageById("13045"));
                        dreamAttention.visible = false;
                    }
                    else
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13120"));
                    }
                });
            }
        });
        object[] fightDta = (object[])myData[5];
        deck = (object[])myData[4];

        userModel = ModelManager.inst.userModel;
        userModel.GetUnlcok(Config.UNLOCK_GUILD, guildName);

        //                [0]	-82	System.Object
        //[1]	"勇敢的龙骑士"	System.Object
        //[2]	9	System.Object
        //[3]	5	System.Object
        //[4] System.Object[8] System.Object
        //[5] System.Object[6] System.Object
        // [6] false	System.Object
        // [7] true	System.Object
        //[8] Count= 1 System.Object
        // [9] null	System.Object
        // [10]    null	System.Object

        list.itemRenderer = OnRender;
        list.numItems     = deck.Length;
        if (!Tools.IsNullEmpty(myData[1]))
        {
            uname.text = myData[1].ToString();
        }
        else
        {
            uname.text = myData[0].ToString();
        }
        comPhoto.GetChild("n2").asTextField.text = myData[2].ToString();
        GButton head = comPhoto.GetChild("n0").asButton;

        head.onClick.Add(OpenUser);

        if ((int)fightDataDetails[0] == 1)
        {
            //comScoreType.visible = false;
            group.visible = false;
            if ((int)myData[0] > 0)
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)myData[6])["use"].ToString()));
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(myData[1].ToString(), false, true));
            }
            if (!Tools.IsNullEmpty(myData[8]))
            {
                guildName.text = myData[8].ToString();
            }
            else
            {
                guildName.text = Tools.GetMessageById("19955");
            }
            scoreTypeNum.text = fightModel.recordIndex.ToString();
            Debug.Log((bool)myData[10]);
            if (!(bool)myData[10])//是否关注
            {
                if (!(bool)myData[11])
                {
                    if ((bool)myData[9])
                    {
                        if (myData[0].ToString().Equals(userModel.uid))
                        {
                            dreamAttention.visible = false;
                        }
                        else
                        {
                            if (ModelRole.attentionFight.Contains(myData[0].ToString()))
                            {
                                dreamAttention.visible = false;
                            }
                            else
                            {
                                dreamAttention.visible = true;
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if ((bool)myData[7])
            {
                //comScoreType.visible = true;
                group.visible = true;

                //scoreTypeBG.url = Tools.GetResourceUrl("Image2:n_icon_paiming0");
                //scoreTypeNum.text = Tools.GetMessageById("24223");
                Tools.GetResourceUrlForMVP(scoreTypeBG, "mvp");
            }
            else
            {
                //comScoreType.visible = false;
                group.visible = false;
            }

            if ((int)myData[0] > 0)
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)myData[9])["use"].ToString()));
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(myData[1].ToString(), false, true));
            }
            if (!Tools.IsNullEmpty(myData[11]))
            {
                guildName.text = myData[11].ToString();
            }
            else
            {
                guildName.text = Tools.GetMessageById("19955");
            }
            Debug.Log((bool)myData[13]);
            if (!(bool)myData[13])//是否关注
            {
                if (!(bool)myData[14])
                {
                    if ((bool)myData[12])
                    {
                        if (myData[0].ToString().Equals(userModel.uid))
                        {
                            dreamAttention.visible = false;
                        }
                        else
                        {
                            if (ModelRole.attentionFight.Contains(myData[0].ToString()))
                            {
                                dreamAttention.visible = false;
                            }
                            else
                            {
                                dreamAttention.visible = true;
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 15
0
    private void ListRender(int index, GObject item)
    {
        GTextField item_status = item.asCom.GetChild("n2").asTextField;

        item_status.visible = true;
        GButton image     = item.asCom.GetChild("n1").asButton;
        GImage  image_bg  = item.asCom.GetChild("n3").asImage;
        GImage  image_Add = item.asCom.GetChild("n8").asImage;
        GImage  bg2       = item.asCom.GetChild("n9").asImage;

        bg2.visible = false;
        Dictionary <string, object> data = (Dictionary <string, object>)listData[index];
        string name   = (string)data["name"];
        int    status = (int)data["status"];

        image.visible = true;
        if (data.ContainsKey("isAdd"))
        {
            bool isAdd = (bool)data["isAdd"];
            if (isAdd)
            {
                image_Add.visible = true;
            }
            else
            {
                image_Add.visible = false;
            }
        }
        else
        {
            image_Add.visible = false;
        }
        item.RemoveEventListeners();
        item.onClick.Add(() =>
        {
            if (image_Add.visible)
            {
                SubPhoto();
            }
            else
            {
                UpdatePhotoHead(item, bg2, name, status, index);
            }
        });

        if (index == 0)
        {
            UpdatePhotoHead(item, bg2, name, status, index);
        }

        if (name != "")
        {
            image_bg.visible = false;
            Tools.SetLoaderButtonUrl(image, ModelUser.GetHeadUrl(name));
            CheckStatus(status, item_status);
        }
        else
        {
            image_bg.visible = true;
            image.GetChild("n0").asLoader.url = "";
            image.visible    = false;
            item_status.text = "";
        }
    }
Ejemplo n.º 16
0
    private void List_Render(int index, GObject go)
    {
        GButton bb = go.asCom.GetChild("n0").asButton;

        if (index == 0 || index % 2 == 0)
        {
            bb.alpha = 0;
        }
        else
        {
            bb.alpha = 1;
        }
//		bb.enabled = false;
        GButton    img_icon    = go.asCom.GetChild("n1").asButton;
        GLoader    img_rank    = go.asCom.GetChild("n7").asCom.GetChild("n1").asLoader;
        GLoader    img_man     = go.asCom.GetChild("n8").asLoader;
        GTextField l_name      = go.asCom.GetChild("n2").asTextField;
        GTextField l_level     = go.asCom.GetChild("n3").asCom.GetChild("n1").asTextField;
        GTextField l_rank      = go.asCom.GetChild("n7").asCom.GetChild("n2").asTextField;
        GTextField l_job       = go.asCom.GetChild("n5").asTextField;
        GTextField l_guildCoin = go.asCom.GetChild("n6").asTextField;
        GTextField n9          = go.asCom.GetChild("n9").asTextField;
        GLoader    n10         = go.asCom.GetChild("n10").asLoader;

        if (index > lis.Count - 1)
        {
            img_icon.visible = false;
            l_name.visible   = false;
            go.asCom.GetChild("n3").visible = false;
            l_job.visible                   = false;
            l_guildCoin.visible             = false;
            go.asCom.GetChild("n7").visible = false;
            n9.visible      = false;
            img_man.visible = false;
            n10.visible     = false;
            bb.touchable    = false;
            go.touchable    = false;
            return;
        }
        else
        {
            img_icon.visible = true;
            l_name.visible   = true;
            go.asCom.GetChild("n3").visible = true;
            l_job.visible                   = true;
            l_guildCoin.visible             = true;
            go.asCom.GetChild("n7").visible = true;
            n9.visible      = true;
            img_man.visible = true;
            n10.visible     = true;
            bb.touchable    = true;
            go.touchable    = true;
        }

        Dictionary <string, object> _data = (Dictionary <string, object>)(lis [index]);

        n9.text = Tools.StartValueTxt(index + 1);         //.ToString ();

        n10.url        = Tools.GetResourceUrl("Image2:n_icon_paiming4");
        n9.strokeColor = Tools.GetColor("426600");
        switch ((index + 1))
        {
        case 1:
            n9.strokeColor = Tools.GetColor("9b5c04");
            n10.url        = Tools.GetResourceUrl("Image2:n_icon_paiming1");
            break;

        case 2:
            n9.strokeColor = Tools.GetColor("4b4b4b");
            n10.url        = Tools.GetResourceUrl("Image2:n_icon_paiming2");
            break;

        case 3:
            n9.strokeColor = Tools.GetColor("853c1d");
            n10.url        = Tools.GetResourceUrl("Image2:n_icon_paiming3");
            break;
        }
        if (_data ["uname"] == null)
        {
            l_name.text = _data ["id"].ToString();
        }
        else
        {
            l_name.text = _data ["uname"].ToString();
        }
        if (ModelManager.inst.userModel.uid == _data ["id"].ToString())
        {
            bb.GetChild("n2").asLoader.url = Tools.GetResourceUrl("Image2:n_bg_tanban6_");
            bb.alpha = 1;
        }
        else
        {
            bb.GetChild("n2").asLoader.url = Tools.GetResourceUrl("Image2:n_bg_tanban6");
        }
        l_rank.text  = _data [Config.ASSET_RANKSCORE].ToString();
        img_rank.url = ModelManager.inst.userModel.GetRankImg((int)_data [Config.ASSET_RANKSCORE]);
//		img_icon.url = ModelUser.GetHeadUrl (((Dictionary<string,object>)_data ["head"]) ["use"] as string);
        Tools.SetLoaderButtonUrl(img_icon, ModelUser.GetHeadUrl(((Dictionary <string, object>)_data ["head"]) ["use"] as string));

        l_level.text     = _data ["lv"].ToString();
        l_job.text       = ModelManager.inst.guildModel.getJob((int)_data ["gradation"]);
        l_guildCoin.text = Tools.GetMessageColor(Tools.GetMessageById("20124") + "[0]" + _data ["contribute"].ToString() + "[/0]", new string[] { "e08002" });

        img_man.url = Tools.GetSexUrl(_data["sex"]);
        bb.RemoveEventListeners();
        bb.onClick.Add(() =>
        {
            Dictionary <string, object> dd = new Dictionary <string, object> ();
            dd ["fuid"] = _data ["id"];
            NetHttp.inst.Send(NetBase.HTTP_FUSERGET, dd, (VoHttp vo) =>
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { _data["id"], _data["id"], type == 1?0:ModelManager.inst.roleModel.tab_CurSelect1, type == 1?0:ModelManager.inst.roleModel.tab_CurSelect2, ModelManager.inst.roleModel.tab_CurSelect3 }));
            });
        });
    }
Ejemplo n.º 17
0
    private void List_Render(int index, GObject item)
    {
//		Debug.LogError("Render Index:" + item.parent.width);
        GComponent go = item.asCom;

        go.name = index + "";
        go.RemoveChildren();
//        go.x = GRoot.inst.width/9;
//		go.x = item.parent.width - go.width;
        Dictionary <string, object> data = (Dictionary <string, object>)ld [index];
        GComponent     it;
        GButton        head;
        GTextField     text;
        GButton        btn1;
        GButton        btn2;
        ComProgressBar bar;

        if (data ["ctype"].ToString() == "chat")
        {
            GImage bg;
            it = Tools.GetComponent(Config.ITEM_CHAT).asCom;
            Controller c1 = it.GetController("c1");
            if (data ["uid"].ToString() == userModel.uid)
            {
                c1.selectedIndex = 1;
                it = it.GetChild("n1").asCom;
            }
            else
            {
                c1.selectedIndex = 0;
                it = it.GetChild("n0").asCom;
            }
            head = it.GetChild("n0").asButton;
            text = it.GetChild("n2").asTextField;
            bg   = it.GetChild("n5").asImage;


            it.GetChild("n1").text = ModelUser.GetUname(data ["uid"], data ["uname"]);
            Dictionary <string, object> use = data ["head"] as Dictionary <string, object>;
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(use ["use"].ToString()));
            text.text = data ["chat"].ToString();
            it.GetChild("n4").text = ((DateTime)data ["time"]).ToString("HH:mm:ss");
            if (text.textHeight > 29)
            {
                float c = text.textHeight - 29;
                bg.height           = bg.height + c;
                go.height           = (115 - 29) + text.textHeight;
                it.GetChild("n4").y = it.GetChild("n4").y + c;
            }
            else
            {
                go.height           = 115;
                it.GetChild("n4").y = 90;
            }
            head.onClick.Add(() =>
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] {
                    null,
                    data ["uid"].ToString(),
                    roleModel.tab_CurSelect1,
                    roleModel.tab_CurSelect2,
                    roleModel.tab_CurSelect3
                }));
            });
            go.AddChild(it);
            chatModel.IsEffect(data, go);
        }
        else if (data ["ctype"].ToString() == "guild")
        {
            GTextField rank;
            it   = Tools.GetComponent(Config.ITEM_GUILD).asCom;
            head = it.GetChild("n3").asButton;
            rank = it.GetChild("n6").asTextField;
            btn1 = it.GetChild("n0").asButton;
            btn2 = it.GetChild("n7").asButton;

            it.GetChild("n4").text = ModelUser.GetUname(data ["uid"], data ["uname"]);
            it.GetChild("n2").text = Tools.GetMessageById("22014");
            Dictionary <string, object> use = data ["head"] as Dictionary <string, object>;
            head.GetChild("n2").text = data ["lv"].ToString();
            Tools.SetLoaderButtonUrl(head.GetChild("n0").asButton, ModelUser.GetHeadUrl(use ["use"].ToString()));
            it.GetChild("n9").text = ((DateTime)data ["time"]).ToString("HH:mm:ss");
            rank.text = Tools.GetMessageById("22002", new string[] { data ["rank_score"].ToString() });
            go.height = 280;
            go.AddChild(it);
            chatModel.IsEffect(data, go);
            btn1.onClick.Add(() =>
            {
                Dictionary <string, object> d1 = new Dictionary <string, object> ();
                d1 ["uid"]  = data ["uid"].ToString();
                d1 ["flag"] = 1;
                NetHttp.inst.Send(NetBase.HTTP_GUILD_JOIN, d1, (VoHttp vo) =>
                {
//					Log.debug (vo.data.ToString ());
                    if (!Convert.ToBoolean(vo.data))
                    {
                        chatModel.RemoveChat("guild", data ["uid"].ToString());
                        ViewManager.inst.ShowText(Tools.GetMessageById("22029"));
                        list.RemoveChildAt(index);
                    }
                });
            });
            btn2.onClick.Add(() =>
            {
                Dictionary <string, object> d1 = new Dictionary <string, object> ();
                d1 ["uid"]  = data ["uid"].ToString();
                d1 ["flag"] = 2;
                NetHttp.inst.Send(NetBase.HTTP_GUILD_JOIN, d1, null);
            });
        }
        else if (data ["ctype"].ToString() == "guild_join")
        {
            it   = Tools.GetComponent(Config.ITEM_TEXT).asCom;
            text = it.GetChild("n0").asTextField;
            Dictionary <string, object> user1 = (Dictionary <string, object>)data ["user1"];
            Dictionary <string, object> user2 = (Dictionary <string, object>)data ["user2"];
            string name2 = ModelUser.GetUname(user2 ["uid"], user2 ["uname"]);
            if (user1 == null)
            {
                text.text = Tools.GetMessageById("22028", new string[] { name2 });
            }
            else
            {
                string name1 = ModelUser.GetUname(user1 ["uid"], user1 ["uname"]);
                if (data ["flag"].ToString() == "1")
                {
                    text.text = Tools.GetMessageById("22004", new string[] { name1, name2 });
                }
                else
                {
                    text.text = Tools.GetMessageById("22005", new string[] { name1, name2 });
                }
            }
            go.height = 70f;
//			try{
            go.AddChild(it);
//			}catch(Exception ee){
//			}
            chatModel.IsEffect(data, go);
        }
        else if (data ["ctype"].ToString() == "guild_modify")
        {
            it   = Tools.GetComponent(Config.ITEM_TEXT).asCom;
            text = it.GetChild("n0").asTextField;
            if (data.ContainsKey("user"))
            {
                Dictionary <string, object> user = (Dictionary <string, object>)data ["user"];
                string name0 = ModelUser.GetUname(user ["uid"], user ["uname"]);
                text.text = Tools.GetMessageById("22030", new string[] { name0 });
            }
            else
            {
                Dictionary <string, object> user1 = (Dictionary <string, object>)data ["user1"];
                Dictionary <string, object> user2 = (Dictionary <string, object>)data ["user2"];
                string name1   = ModelUser.GetUname(user1 ["uid"], user1 ["uname"]);
                string name2   = ModelUser.GetUname(user2 ["uid"], user2 ["uname"]);
                int    num     = Convert.ToInt32(data ["num"]);
                int    old_num = Convert.ToInt32(data ["old_num"]);
                if (num == -1)
                {
                    text.text = Tools.GetMessageById("22008", new string[] { name1, name2 });
                }
                else if (num == 0)
                {
                    text.text = Tools.GetMessageById("22009", new string[] { name1, name2 });
                }
                else if (num < old_num)
                {
                    text.text = Tools.GetMessageById("22006", new string[] { name1, name2 });
                }
                else
                {
                    text.text = Tools.GetMessageById("22007", new string[] { name1, name2 });
                }
            }
            go.height = 70;
            go.AddChild(it);
            chatModel.IsEffect(data, go);
        }
        else if (data ["ctype"].ToString() == "send_guild_redbag")
        {
//			go.name = go.name+"_isRed";
            it = Tools.GetComponent(Config.ITEM_RED1).asCom;
            GLoader load = it.GetChild("n6").asLoader;
            load.url = data ["type"].ToString() == "0" ? Tools.GetResourceUrl("Image2:n_icon_bthb2") : Tools.GetResourceUrl("Image2:n_icon_bthb1");
//			it.GetChild ("n1").text = ModelUser.GetUname (data ["uid"], data ["uname"]);
            string ti = Tools.GetMessageById("22017", new string[] { ModelUser.GetUname(data ["uid"], data ["uname"]) });
            ti = Tools.GetMessageColor(ti, new string[] { "dc8100" });
            it.GetChild("n2").text     = ti;
            it.GetChild("n4").text     = ((DateTime)data ["time"]).ToString("HH:mm:ss");
            it.GetChild("n11").text    = Tools.GetMessageById("22011");
            it.GetChild("n12").visible = true;
            if (Convert.ToBoolean(data ["is_my_grab"]))
            {
                it.GetChild("n12").text = Tools.GetMessageById("22034");
            }
            else if (Convert.ToBoolean(data ["is_grab_all"]))
            {
                it.GetChild("n12").text = Tools.GetMessageById("22046");
            }
            else
            {
                it.GetChild("n12").visible = false;
            }
            load.onClick.Add(() =>
            {
                if (!chatModel.isSendRedBagOutTime(data))
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22039"));
                    return;
                }
                Dictionary <string, object> d = new Dictionary <string, object> ();
                d ["redbag_id"] = data ["id"].ToString();
                NetHttp.inst.Send(NetBase.HTTP_GRABGUILDREDBAG, d, (VoHttp vo) =>
                {
                    Dictionary <string, object> da   = (Dictionary <string, object>)vo.data;
                    Dictionary <string, object> gift = (Dictionary <string, object>)da ["gift"];
                    chatModel.grab_List = (object[])da ["grab_list"];
                    chatModel.card_List = (object[])da ["card_list"];
                    chatModel.grab_Type = Convert.ToInt32(data ["type"]);
                    if (gift == null)
                    {
                        if (!Convert.ToBoolean(data ["is_my_grab"]))
                        {
                            data ["is_avable"]  = false;
                            data ["is_my_grab"] = true;
                            chatModel.UpdateRedBagData(data);
                            chatModel.Remove_RedCount();
                            this.List_Render(index, item);
                        }
                        ViewManager.inst.ShowView <MediatorRed2> ();
                    }
                    else
                    {
                        data ["is_avable"]  = false;
                        data ["is_my_grab"] = true;
                        chatModel.UpdateRedBagData(data);
                        chatModel.Remove_RedCount();
                        this.List_Render(index, item);
                        chatModel.isRedbagGift = true;
                        //ViewManager.inst.ShowIcon (gift, () =>
                        //{
                        int gold = userModel.gold;
                        userModel.UpdateData(vo.data);
                        int gold2 = gift.ContainsKey("gold") ? Convert.ToInt32(gift["gold"]) : 0;
                        if (gold + gold2 != userModel.gold)
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("33212"));
                        }
                        userModel.records ["guild_redbag_log"] = da ["guild_redbag_log"];
                        ViewManager.inst.ShowView <MediatorRed2> ();
//						});
//						ViewManager.inst.ShowReward (gift);
                    }
                });
            });
            go.height = 280;
            go.AddChild(it);
            chatModel.IsEffect(data, go);
        }
        else if (data ["ctype"].ToString() == "require_guild_support")
        {
//			go.name = go.name+"_isRed";
            it   = Tools.GetComponent(Config.ITEM_REQUEST).asCom;
            text = it.GetChild("n2").asTextField;
            bar  = it.GetChild("n9") as ComProgressBar;
            bar.SetTextSize(28);
            bar.offsetY = 8;
            ComCard ci = it.GetChild("n8") as ComCard;
            btn1      = it.GetChild("n5").asButton;
            btn1.text = Tools.GetMessageById("22049");
            bar.skin  = ComProgressBar.BAR7;

            CardVo vo = DataManager.inst.GetCardVo(data ["cid"].ToString());
            text.text = Tools.GetMessageById("22019");
            it.GetChild("n16").text = Tools.GetMessageById("22012");
            it.GetChild("n10").text = Tools.GetMessageById("22033");
            it.GetChild("n18").text = Tools.GetMessageColor("[0]" + vo.exp + "[/0]/" + vo.maxExp, new string[] { "a6fb30" });
            it.GetChild("n1").text  = ModelUser.GetUname(data ["uid"], data ["uname"]);
            it.GetChild("n4").text  = ((DateTime)data ["time"]).ToString("HH:mm:ss");
            Dictionary <string, object> da = (Dictionary <string, object>)data ["data"];
            int count = 0;
            foreach (string n in da.Keys)
            {
                count += Convert.ToInt32(da [n]);
            }
            int max = chatModel.GetCardRequestCount(data ["cid"].ToString(), Convert.ToInt32(data ["effort_lv"]));
            bar.value = count;
            bar.max   = max;
            it.GetChild("n20").asTextField.text = bar.text;
            ci.SetData(vo.id, 1, 1);
            ci.SetText(Tools.GetMessageById(vo.name));
            if (data ["uid"].ToString() == userModel.uid || vo.exp == 0 || !chatModel.IsSendGiveCard() ||
                !chatModel.IsSendCardOver(data) || !chatModel.isSendSupportOutTime(data) || count >= max)
            {
                go.name     = go.name + "_isExc";
                btn1.grayed = true;
            }
            btn1.onClick.Add(() =>
            {
                if (isRequestEffect)
                {
                    return;
                }
                if (count >= max)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22038"));
                    return;
                }
                else if (data ["uid"].ToString() == userModel.uid)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22035"));
                    return;
                }
                else if (vo.exp == 0)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22036"));
                    return;
                }
                else if (!chatModel.IsSendGiveCard())
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22022"));
                    return;
                }
                else if (!chatModel.IsSendCardOver(data))
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22024"));
                    return;
                }
                else if (!chatModel.isSendSupportOutTime(data))
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("22037"));
                    return;
                }
                Dictionary <string, object> d = new Dictionary <string, object> ();
                d ["support_id"] = data ["id"].ToString();
                NetHttp.inst.Send(NetBase.HTPP_SENDGUILDSUPPORT, d, (VoHttp v) =>
                {
                    chatModel.Remove_RedCount();
                    isRequestEffect = true;
                    ViewManager.inst.ShowIcon(userModel.GetReward(v.data), () =>
                    {
                        userModel.UpdateData(v.data);
                        chatModel.UpdateGuildSupport(data);
                        DispatchManager.inst.Dispatch(new MainEvent(MainEvent.CHAT_SENDGUILDSUPPORT));
                        isRequestEffect = false;
                    });
                });
            });
            go.height = 300;
            go.AddChild(it);
            chatModel.IsEffect(data, go);
        }
        else if (data ["ctype"].ToString() == "guild_fight_share")
        {
            it = Tools.GetComponent(Config.ITEM_SHARE).asCom;
            object[] fight = (object[])data ["fight_data"];
//			it.GetChild ("n4").text = ModelUser.GetUname (data ["uid"], data ["uname"]);
            string na = "[0]" + ModelUser.GetUname(data ["uid"], data ["uname"]) + "[/0]";
            na = Tools.GetMessageColor(na, new string[] { "dc8100" });
            if (fight [0].ToString() == "1")
            {
                it.GetChild("n2").text = na + Tools.GetMessageById("22042");
            }
            else
            {
                it.GetChild("n2").text = na + Tools.GetMessageById("22043");
            }
            it.GetChild("n6").text = data ["chat"].ToString();
            it.GetChild("n9").text = ((DateTime)data ["time"]).ToString("HH:mm:ss");
            it.GetChild("n0").asButton.onClick.Add(() =>
            {
                this.DispatchGlobalEventWith(MainEvent.SHOW_FIGHTDETAIL, data);
            });
            go.height = 255;
            go.AddChild(it);
            chatModel.IsEffect(data, go);
        }
//		go.Center ();
    }
Ejemplo n.º 18
0
    private void ItemRender(int index, GObject item)
    {
        GComponent g    = item.asCom;
        GLoader    img  = g.GetChild("n14").asCom.GetChild("n1").asLoader;
        GTextField txt  = g.GetChild("n14").asCom.GetChild("n2").asTextField;
        GButton    head = g.GetChild("n1").asButton;
        //  head.GetChild("n0").asButton.GetChild("n2").asImage.visible = false;//隐藏邀请界面头像圈
        GButton btn      = g.GetChild("n6").asButton;
        GButton btn_mask = g.GetChild("n9").asButton;


        bool IsVisible = SetListCSS(item, fightModel.curInvite, index);

        Log.debug("IsVisible" + IsVisible + "," + fightModel.curInvite.Length + "ddd" + index);
        if (IsVisible)
        {
            Dictionary <string, object> data = (Dictionary <string, object>)fightModel.curInvite[index];
            g.GetChild("n3").text = ModelUser.GetUname(data["uid"], data["name"]);
            //		g.GetChild ("n4").text = data ["guild_name"] == null ? Tools.GetMessageById ("25034") : data ["guild_name"].ToString ();
            //		g.GetChild ("n13").text = data ["lv"].ToString ();
            //		g.GetChild ("n2").asLoader.url = Tools.GetSexUrl (data ["sex"]);
            //		Controller c1 = g.GetController ("c1");
            //g.GetChild("n0").visible = ((index % 2) != 0);
            if (tabC1.selectedIndex == 0)
            {
                g.GetChild("n7").text = Tools.GetNearDistance(data["dis"]);
            }
            else
            {
                string state = data["state"].ToString();
                if (state == "0")
                {
                    g.GetChild("n7").text = Tools.GetMessageById("25029");
                }
                else if (state == "1")
                {
                    if (fightModel.isTeam(data["uid"].ToString()))
                    {
                        g.GetChild("n7").text = Tools.GetMessageById("25052");
                    }
                    else
                    {
                        g.GetChild("n7").text = Tools.GetMessageById("25030");
                    }
                }
                else if (state == "2")
                {
                    g.GetChild("n7").text = Tools.GetMessageById("25051");
                }
            }

            img.url  = userModel.GetRankImg(data["rank_score"]);
            txt.text = data["rank_score"].ToString();

            head.GetChild("n2").text = data["lv"].ToString();
            Tools.SetLoaderButtonUrl(head.GetChild("n0").asButton, ModelUser.GetHeadUrl(Tools.Analysis(data, "head.use").ToString()));
            btn.selected = Convert.ToBoolean(data["check"]);
            btn.RemoveEventListeners();
            btn.onClick.Add(() =>
            {
                btn.selected             = !btn.selected;
                data["check"]            = btn.selected;
                this.GetChild("n7").text = Tools.GetMessageById("25036", new string[] { fightModel.GetCheck().ToString() });
                bool isok      = fightModel.GetInviteSelectAll(tabC1.selectedIndex);
                check.selected = isok;
            });

            btn_mask.RemoveEventListeners();
            btn_mask.onClick.Add(() =>
            {
                btn.selected             = !btn.selected;
                data["check"]            = btn.selected;
                this.GetChild("n7").text = Tools.GetMessageById("25036", new string[] { fightModel.GetCheck().ToString() });
                bool isok      = fightModel.GetInviteSelectAll(tabC1.selectedIndex);
                check.selected = isok;
            });
        }
    }
Ejemplo n.º 19
0
    private void InitItem()
    {
        if (roleModel.rankData["type"] != null)
        {
            if ((int)roleModel.rankData["type"] == 3)
            {
                list.emptyStr = Tools.GetMessageById("31081");
            }
            else
            {
                list.emptyStr = Tools.GetMessageById("31073");
            }
        }

        list.itemRenderer = OnRender;
        list.SetVirtual();
        list.onChangeNum.Add(this.CheckListNum);
        if (listData != null)
        {
            data  = ModelManager.inst.rankModel.IsContainUser(listData, userModel.uid);
            index = (int)data["index"];
            if (data["data"] != null)
            {
                Dictionary <string, object> data1 = (Dictionary <string, object>)data["data"];
//				try{
//				head1.url = Tools.SetLoaderButtonUrl(null,ModelUser.GetHeadUrl(((Dictionary<string, object>)data1["head"])["use"].ToString()),head1);
//                head2.url = ModelUser.GetHeadUrl(((Dictionary<string, object>)data1["head"])["use"].ToString());
                Tools.SetLoaderButtonUrl(null, ModelUser.GetHeadUrl(((Dictionary <string, object>)data1["head"])["use"].ToString()), head1);
                Tools.SetLoaderButtonUrl(null, ModelUser.GetHeadUrl(((Dictionary <string, object>)data1["head"])["use"].ToString()), head2);
//				}catch(Exception e){
//					Debug.Log ("");
//				}
            }

            list.scrollPane.onScroll.Add(() =>
            {
                if (list.scrollPane.posY <= 0)
                {
                    search_user_top.visible = false;
                    top.visible             = false;
                }
                else
                {
                    top.visible = true;
                    //search_user_botton.visible = false;
                }
            });
            list.onTouchEnd.Add(() => {
                int scrollIndex = list.GetFirstChildInView();
                if ((bool)data["isContain"])
                {
                    if (scrollIndex > 0)
                    {
                        top.visible = true;
                        if (scrollIndex + 5 < index)
                        {
                            search_user_top.visible    = false;
                            search_user_botton.visible = true;
                        }
                        else if (scrollIndex + 5 >= index)
                        {
                            if (scrollIndex <= index)
                            {
                                search_user_top.visible    = false;
                                search_user_botton.visible = false;
                            }
                            else
                            {
                                search_user_top.visible    = true;
                                search_user_botton.visible = false;
                            }
                        }
                    }
                    else
                    {
                        top.visible = false;
                        if (index > -1 && index < 6)
                        {
                            search_user_top.visible    = false;
                            search_user_botton.visible = false;
                        }
                        else
                        {
                            search_user_top.visible    = false;
                            search_user_botton.visible = true;
                        }
                    }
                }
                else
                {
                    search_user_top.visible    = false;
                    search_user_botton.visible = false;
                    if (scrollIndex > 0)
                    {
                        top.visible = true;
                    }
                    else
                    {
                        top.visible = false;
                    }
                }
            });
            if (listData.Count <= 5)
            {
                list.scrollPane.touchEffect = false;
            }
            else
            {
                if ((bool)data["isContain"])
                {
                    if (index > 6)
                    {
                        search_user_botton.visible = true;
                        search_user_top.visible    = false;
                    }
                }
            }
            //list.itemRenderer = OnRender;
            //list.SetVirtual();
            //list.numItems = listData.Count;
            //SetListCss(list, listData.ToArray(), 6);
        }

        //else
        //{
        //    //list.itemRenderer = OnRender;
        //    //list.SetVirtual();
        //    list.numItems = 0;
        //}
        SetListCSS(list, listData.ToArray(), 6, true);
    }
Ejemplo n.º 20
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);
        });
    }
Ejemplo n.º 21
0
    private void OnRendere(int index, GObject item)
    {
        GComponent g         = item.asCom;
        GObject    reletion  = g.GetChild("n3");
        GButton    headBtn   = g.GetChild("n2").asButton;
        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;

        userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);

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

        if (isVisible)
        {
            btn_.visible = true;
            //mask_btn.SetSize(622, 71);
            btn_.text        = Tools.GetMessageById("19911");
            reletion.visible = false;
            msg.visible      = false;
            status.visible   = false;
            GTextField lv = g.GetChild("n2").asCom.GetChild("n2").asTextField;
            Dictionary <string, object> dc = (Dictionary <string, object>)listData[index];

            btn_.GetChild("n1").asLoader.url = Tools.GetResourceUrl("Image2:n_btn_4");
            Tools.SetRootTabTitleStrokeColor(btn_.GetChild("title").asTextField, "#dd8680", 2);
            btn_.RemoveEventListeners();
            btn_.onClick.Add(() =>
            {
                Dictionary <string, object> dd = new Dictionary <string, object>();
                dd["fuid"] = dc["uid"];
                NetHttp.inst.Send(NetBase.HTTP_CANCLESHIELDING, dd, (VoHttp vo) =>
                {
                    if ((bool)vo.data == true)
                    {
                        SendNetMesage("");
                        ViewManager.inst.ShowText(Tools.GetMessageById("19913"));
                    }
                });
            });
            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"] + "";
            }
            //msg.text = "23小时前成就等级提升至99级";
            rankScore.text = dc["rank_score"] + "";
        }
        else
        {
            btn_.visible = false;
        }
    }
Ejemplo n.º 22
0
    private void InitBaseView()
    {
        lv.text = otherInfo["lv"].ToString();
        //if (!Tools.IsNullEmpty(otherInfo["area"]))
        //{
        //    //addr.text = roleModel.GetAddrCfg (addrDiction, "", otherInfo ["area"].ToString ());
        //}
        //else
        //{
        //    //addr.text = Tools.GetMessageById ("14501");
        //}
        sex.url = Tools.GetSexUrl(otherInfo["sex"]);



        if (otherInfo["uname"] != null)
        {
            SetName(name, otherInfo["uname"].ToString());
        }
        else
        {
            SetName(name, otherInfo["uid"] + "");
        }
        if (otherInfo["guild"] == null)
        {
            guild.touchable = false;
            //guild.text = Tools.GetMessageById("19955");
            Tools.SetButtonBgAndColor(guild, btnBgDo, textGuildd, fontSize, textBtnColor, textBtnStrokeColor1);
        }
        else
        {
            //guild.text = otherInfo["guild"] + "";
            Tools.SetButtonBgAndColor(guild, btnBgUp, textGuild, fontSize, textBtnColor, textBtnStrokeColor);
            //guild.text = Tools.GetMessageById("19908");
        }
        if (otherInfo["uid"].ToString().Equals(userModel.uid))
        {
            if (Tools.checkHead())
            {
                Tools.SetLoaderButtonUrl(photoHead, ModelUser.GetHeadUrl((string)userModel.head["use"]));
            }
            else
            {
                Tools.SetLoaderButtonUrl(photoHead, ModelUser.GetHeadUrl("h01"));
                Dictionary <string, object> data1 = new Dictionary <string, object>();
                data1["head_key"] = "h01";
                NetHttp.inst.Send(NetBase.HTTP_CHOOSE_HEAD, data1, (VoHttp vo1) =>
                {
                    userModel.UpdateData(vo1.data);
                });
            }


            like_bg.visible = true;
            //string str_story = "";
            if (!Tools.IsNullEmpty(userModel.story))
            {
                story.text     = userModel.story;
                sign_text_temp = userModel.story;
            }
            else
            {
                sign_text_temp = "";
            }

            story.onFocusOut.Add(() =>
            {
                story.text = story.text.Trim();

                story.text = FilterManager.inst.Exec(story.text);
                if (!story.text.Equals(sign_text_temp))
                {
                    isStory = true;
                }
                sign_text_temp = story.text;
                Save();
            });
            story.onChanged.Add(() =>
            {
                story.text = Tools.GetStringByLength(story.text, storyNum);
                story.text = Tools.StrReplace(story.text);
            });
        }
        else
        {
            Dictionary <string, object> dc = (Dictionary <string, object>)otherInfo["head"];
            Tools.SetLoaderButtonUrl(photoHead, ModelUser.GetHeadUrl((string)dc["use"]));
            if (otherInfo["story"] != null)
            {
                story.text = (string)otherInfo["story"];
                story.text = Regex.Replace(story.text, @"[/n/r]", "");
                story.text = story.text.TrimEnd((char[])"/n/r".ToCharArray());
            }
            story.touchable = false;
        }
    }
Ejemplo n.º 23
0
    private void Get_Red(VoHttp vo)
    {
        Dictionary <string, object> data = (Dictionary <string, object>)vo.data;

        object[] da = data["res"] as object[];
        reData     = da;
        l_num.text = da.Length.ToString();
        mc         = new GameObject[da.Length];
        for (int i = (da.GetLength(0) - 1); i >= 0; i--)
        {
            item_box = Tools.GetComponent(Config.RED_PEOPLE).asCom;
            item_box.GetChild("tag_scale").visible = false;
            this.item_box.GetChild("n1").visible   = false;
            this.item_box.GetChild("n4").visible   = false;
            item_go = EffectManager.inst.AddEffect(Config.EFFECT_GIFT, "stand", item_box.GetChild("n2").asGraph);
            GameObjectScaler.ScaleParticles(item_go, 0.3f);
            Dictionary <string, object> js = (Dictionary <string, object>)da [i];

            //EffectManager.inst.StopAnimation (mc [i]);
            GTextField l    = item_box.GetChild("n1").asTextField;
            GButton    head = item_box.GetChild("n4").asCom.GetChild("n0").asButton;
            String     dc_  = (string)js["head_use"];
            if (js["uid"].ToString().StartsWith("bot"))
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(dc_, false, true));
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(dc_));
            }
            //l.visible = false;
            if (js ["uname"] != null)
            {
                //l.text = Tools.GetMessageById("12010",new string[] {js["uname"].ToString() });
                l.text = js["uname"].ToString();
            }
            else
            {
                // l.text = Tools.GetMessageById("12010", new string[] { js["uid"].ToString() });
                l.text = js["uid"].ToString();
            }
            //Debug.LogError("uname  " + js["uname"].ToString());
//            Debug.LogError("head_use  " + js["head_use"].ToString()+" || "+"uid  "+js["uid"].ToString());
            //item.GetChild ("n2").asGraph.rotation = UnityEngine.Random.Range (-10f, 10f);
            mc[i] = item_go;
            aa[i] = item_box;
            item_box.SetPivot(0.5f, 0.5f);
            this.AddChild(item_box);
            item_box.scale = new Vector2(0.3f, 0.3f);             //

            float half = Convert.ToSingle(da.GetLength(0)) / 2f + 0.5f;
            half = half - (i + 1);
//			item.x = Tools.offectSetX (((float)-half * 165f) + 430);
            //item.GetChild ("n1").y = 100;
//			item.y = i%2f * 30f + 100f;
            item_box.x = Tools.offectSetX(((float)i * 80) - 160f + 250f);
            item_box.y = i % 2f * 30f + 100f;

//			if (i == 0) {
//				item.x = -100;
//				item.y = -100;
//			}
//			item.TweenMove (new Vector2 (Tools.offectSetX (((float)i * 90) - 150f + 250f), i%2f * 30f + 100f), 0f);
        }
//		for (int j = (da.GetLength (0) - 1);j>=0;j--) {
//			float half = Convert.ToSingle (da.GetLength (0)) / 2f + 0.5f;
//			half = half - (j + 1);
//			aa [j].TweenScale (new Vector2 (0.5f, 0.5f), 0.5f);
//			GameObjectScaler.ScaleParticles ((aa [j]).displayObject.gameObject, 0.3f);
//			aa [j].TweenMove (new Vector2 (Tools.offectSetX (((float)j * 90) - 150f + 250f), j%2f * 30f + 100f), 0.5f);
//		}
        //
        step1 = false;
        step2 = false;
        //
        this.SetChildIndex(img_num, this.numChildren - 1);
        this.SetChildIndex(l_num, this.numChildren - 1);
        reData1 = DataChuLione((Dictionary <string, object>)((Dictionary <string, object>)reData [reNumIndex]) ["gifts_dict"]);
        len     = reData1.Count - 1;

        //
        this.item_go  = mc [reNumIndex];
        this.item_box = aa [reNumIndex];
        //
        ClickBtn.onClick.Add(Mask_Click);
        //
        OverFun(1);
    }
Ejemplo n.º 24
0
    private void List_Render(int index, GObject go)
    {
        bool isVisible = SetListCSS(go, listData.ToArray(), index);

        if (isVisible)
        {
            Dictionary <string, object> d = (Dictionary <string, object>)(listData[index]);
            string     name     = (string)d["name"];
            string     head_use = (string)d["head_use"];
            GTextField lv       = go.asCom.GetChild("n4").asCom.GetChild("n2").asTextField;
            GButton    photo    = go.asCom.GetChild("n4").asCom.GetChild("n0").asButton;
            go.asCom.GetChild("n10").asTextField.visible = false;
            Dictionary <string, object> gift    = (Dictionary <string, object>)d["content"];
            Dictionary <string, object> cardCfg = DataManager.inst.card;
            // Debug.LogError("name  "+d["name"].ToString()+" || "+"uid  "+d["uid"].ToString()+" || "+"head_use "+ d["head_use"].ToString());
            GButton head    = go.asCom.GetChild("n4").asCom.GetChild("n0").asButton;
            GButton btn_att = go.asCom.GetChild("n5").asButton;
            btn_att.text = Tools.GetMessageById("13147");
            string giftName = "";
            string gifts    = "";
            //if(index == 0 || index % 2 == 0) {
            //    go.asCom.GetChild("itemBg").visible = false;
            //} else {
            //    go.asCom.GetChild("itemBg").visible = true;
            //}

            lv.text = d["lv"].ToString();
            Tools.SetLoaderButtonUrl(photo, ModelUser.GetHeadUrl(head_use));
            //contecnt
            foreach (string s in gift.Keys)
            {
                giftName = s;
                if (giftName == Config.ASSET_CARD)
                {
                    foreach (string cid in ((Dictionary <string, object>)(gift[Config.ASSET_CARD])).Keys)
                    {
                        Dictionary <string, object> cardidcfg = (Dictionary <string, object>)cardCfg[cid];
                        if (gifts == "")
                        {
                            gifts += "  [" + giftName + (int)cardidcfg["rarity"] + "2]" + " x " + "[color=#f38917]" + (int)(((Dictionary <string, object>)gift[giftName])[cid]) + "[/color]";
                        }
                        else
                        {
                            gifts += "  [" + giftName + (int)cardidcfg["rarity"] + "2]" + " x " + "[color=#f38917]" + (int)(((Dictionary <string, object>)gift[giftName])[cid]) + "[/color]";
                        }
                    }
                }
                else
                {
                    if (gifts == "")
                    {
                        gifts = "[" + giftName + "2]" + " x " + "[color=#f38917]" + (int)gift[giftName] + "[/color]  " + gifts;
                    }
                    else
                    {
                        gifts = "[" + giftName + "2]" + " x " + "[color=#f38917]" + (int)gift[giftName] + "[/color]  " + gifts;
                    }
                }
            }

            if (name == null)
            {
                name = d["uid"] + "";
            }
            string str = Tools.GetMessageById("12002", new string[] {
                "[color=#f38917]" + name + "[/color]  ",
                gifts
            });
            go.asCom.GetChild("n0").asRichTextField.text = BaseUbbParser.inst.Parse(str);

            //AttentionBtn
            //if(!(bool)d["if_black"] && !(bool)d["if_friend"] && !(bool)d["request_sign"] || d["uid"].ToString() == userModel.uid) {
            //    btn_att.visible = false;
            //} else {
            //    btn_att.visible = true;
            //}
            if ((bool)d["request_sign"])
            {
                if ((bool)d["if_black"] || (bool)d["if_friend"])
                {
                    btn_att.visible = false;
                }
                else
                {
                    btn_att.visible = true;
                }
            }
            else
            {
                btn_att.visible = false;
            }

            if (d["uid"].ToString() == userModel.uid)
            {
                btn_att.visible = false;
            }

            if ((bool)d["if_friend"])
            {
                btn_att.visible = false;
                go.asCom.GetChild("n10").asTextField.visible = true;
                go.asCom.GetChild("n10").asTextField.text    = Tools.GetMessageById("13018");
            }

            if (btn_att.visible)
            {
                if (LocalStore.GetFriendUID().IndexOf(d["uid"].ToString() + ",") > -1)
                {
                    btn_att.visible = false;
                    go.asCom.GetChild("n10").asTextField.visible = true;
                    go.asCom.GetChild("n10").asTextField.text    = Tools.GetMessageById("13018");
                }
                else
                {
                    btn_att.visible = true;
                }
            }



            btn_att.onClick.Add(() => {
                Dictionary <string, object> dataAtt = new Dictionary <string, object>();
                dataAtt["fuid"] = d["uid"];
                NetHttp.inst.Send(NetBase.HTTP_FOLLOW, dataAtt, (VoHttp vo) => {
                    if ((bool)vo.data == true)
                    {
                        roleModel.AddAttentionFight(d["uid"].ToString());
                        btn_att.visible = false;
                        go.asCom.GetChild("n10").asTextField.visible = true;
                        go.asCom.GetChild("n10").asTextField.text    = Tools.GetMessageById("13018");
                        LocalStore.SetFriendUID(d["uid"].ToString());
                    }
                });
            });
        }
    }
Ejemplo n.º 25
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"] + "";
        }
    }
Ejemplo n.º 26
0
    private void Guest_Render(int index, GObject item)
    {
        GComponent go = item.asCom;

//		go.RemoveChildren ();
        if (guestBookList.Count != 0)
        {
            Dictionary <string, object> dc = (Dictionary <string, object>)guestBookList[index];
            GComponent itp;
            GComponent it;
            GButton    head;
            GTextField text;
            GButton    more;
            GImage     bg;
            if (!dc["uid"].Equals("more"))
            {
//                go.RemoveChildren();
//				go.GetController ("c1").selectedIndex = 1;
                go.GetChild("n4").visible = true;
                go.GetChild("n2").visible = false;
                string a = userModel.uid;
                string b;
                if (dc.ContainsKey("fuid"))
                {
                    b = dc["fuid"] + "";
                }
                else
                {
                    b = dc["uid"] + "";
                }
//                it = Tools.GetComponent(Config.ITEM_CHATROLEINFO).asCom;
                itp = go.GetChild("n4").asCom;
                Controller c1 = itp.GetController("c1");
                if (a.Equals(b))
                {
                    c1.selectedIndex = 1;
                    it = itp.GetChild("n1").asCom;
                }
                else
                {
                    c1.selectedIndex = 0;
                    it = itp.GetChild("n0").asCom;
                }
                head = it.GetChild("n0").asButton;
                text = it.GetChild("n2").asTextField;
                bg   = it.GetChild("n5").asImage;

                if (dc.ContainsKey("fhead"))
                {
                    Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl((string)dc["fhead"]));
                    head.RemoveEventListeners();
                    head.onClick.Add(() =>
                    {
                        string uid_ = dc["fuid"] + "";
                        if (!uid_.Equals(roleModel.otherInfo["uid"]))
                        {                        // roleModel.otherInfo["uid"].ToString()
                            this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, uid_, roleModel.tab_Role_CurSelect1, roleModel.tab_Role_CurSelect2, roleModel.tab_Role_CurSelect3 }));
                        }
                        else
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
                        }
                    });
                }
                if (dc.ContainsKey("msg"))
                {
                    text.text = (string)dc["msg"];
                }
                if (dc.ContainsKey("funame"))
                {
                    it.GetChild("n1").text = (string)dc["funame"];
                }
                else
                {
                    it.GetChild("n1").text = dc["fuid"] + "";
                }
                if (dc.ContainsKey("subtime"))
                {
                    DateTime dt1  = Convert.ToDateTime(ModelManager.inst.gameModel.time.ToString("yyyy - MM - dd"));
                    DateTime dt2  = Convert.ToDateTime(((DateTime)dc["subtime"]).ToString("yyyy-MM-dd"));
                    TimeSpan span = dt1.Subtract(dt2);
                    if (span.Days < 1)
                    {
                        it.GetChild("n4").text = ((DateTime)dc["subtime"]).ToString("HH:mm");
                    }
                    else
                    {
                        it.GetChild("n4").text = ((DateTime)dc["subtime"]).ToString("yyyy-MM-dd HH:mm");
                    }
                }
                bg.height           = text.height + 40;
                it.height           = text.height + it.GetChild("n4").height + it.GetChild("n1").height + 25;
                it.GetChild("n4").y = text.y + text.height + 25;
                go.height           = it.height + 25;
//                go.AddChild(it);
            }
            else
            {
//				go.GetController ("c1").selectedIndex = 0;
                go.GetChild("n4").visible = false;
                go.GetChild("n2").visible = true;
                more      = go.GetChild("n2").asButton;
                more.text = Tools.GetMessageById("13065");
                more.onClick.Add(() =>
                {
                    Dictionary <string, object> dc_more = new Dictionary <string, object>();
                    dc_more["id"]  = tag_g;
                    dc_more["uid"] = otherInfo["uid"];
                    NetHttp.inst.Send(NetBase.HTTP_GETMSG, dc_more, (VoHttp vo) =>
                    {
                        Dictionary <string, object> temp = (Dictionary <string, object>)(vo.data);
                        object[] msgList = (object[])temp["msg_list"];
                        if (msgList.Length != 0)
                        {
                            tag_g = (int)((Dictionary <string, object>)msgList[msgList.Length - 1])["id"];
                            foreach (object st in (object[])temp["msg_list"])
                            {
                                guestBookList.Add(st);
                            }
                            Tools.Sort(guestBookList, new string[] { "subtime:datetime:0" });
                            list_guest.numItems = guestBookList.Count;
                            list_guest.ScrollToView(guestBookList.Count - 30);
                        }
                        else
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("13043"));
                        }
                    });
                });
            }
        }
    }
Ejemplo n.º 27
0
    private void OnRender(int index, GObject item)
    {
        GComponent start   = item.asCom.GetChild("n8").asCom;
        GLoader    change  = item.asCom.GetChild("n9").asLoader;
        GTextField num     = item.asCom.GetChild("n1").asTextField;
        GButton    head    = item.asCom.GetChild("n2").asCom.GetChild("n0").asButton;
        GTextField name    = item.asCom.GetChild("n4").asTextField;
        GTextField guild   = item.asCom.GetChild("n5").asTextField;
        GTextField lv      = item.asCom.GetChild("n2").asCom.GetChild("n2").asTextField;
        GTextField rank    = item.asCom.GetChild("n12").asCom.GetChild("n2").asTextField;
        GLoader    achieve = item.asCom.GetChild("n12").asCom.GetChild("n1").asLoader;
        GButton    mask    = item.asCom.GetChild("n11").asButton;
        GImage     bg_     = item.asCom.GetChild("itemBg_").asImage;

        bg_.visible = false;
        userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);
        //GLoader item_bg = item.asCom.GetChild("n0").asLoader;

        //        if (d1["uid"].ToString().Equals(userModel.uid))
        //        {
        //            item_bg.url = Tools.GetResourceUrl("Image:bg_zidichen7");
        //        }
        //        else
        //        {
        //            item_bg.url = Tools.GetResourceUrl("Image:bg_zidichen3");
        //        }
        //if (index % 2 == 0) {
        //	item_bg.url = "";//Tools.GetResourceUrl("Image2:n_bg_tanban6");
        //} else {
        //	item_bg.url = Tools.GetResourceUrl("Image2:n_bg_tanban6");
        //}

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

        if (isVisible)
        {
            Dictionary <string, object> d1 = (Dictionary <string, object>)listData[index];
            if (d1["uid"].ToString().Equals(userModel.uid))
            {
                bg_.visible = true;
            }
            string headurl = ((Dictionary <string, object>)d1["head"])["use"].ToString();
            //			try{
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(headurl));
//			}catch(Exception eeee){
//				Debug.LogError (d1["uid"].ToString() +" || "+headurl);
//			}
            mask.RemoveEventListeners();
            mask.onClick.Add(() => {
                roleModel.SetTempData(listData, new int[] { list.GetFirstChildInView() });
                string fuid = d1["uid"] + "";
                string uid  = userModel.uid;
                if (fuid != uid)
                {
                    this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, d1["uid"], roleModel.tab_CurSelect1, roleModel.tab_CurSelect2, roleModel.tab_CurSelect3 }));
                }
                else
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
                }
            });
            if ((int)d1["rank_diff"] == 0)
            {
                change.url = Tools.GetResourceUrl("Image2:n_icon_bianhua3");
                num.text   = "";
            }
            else if ((int)d1["rank_diff"] > 0)
            {
                change.url = Tools.GetResourceUrl("Image2:n_icon_bianhua1");
                num.text   = Tools.GetMessageColor("[0]" + d1["rank_diff"] + "[/0]", new string[] { "4db10c" });
            }
            else
            {
                change.url = Tools.GetResourceUrl("Image2:n_icon_bianhua2");
                num.text   = Tools.GetMessageColor("[0]" + d1["rank_diff"] + "[/0]", new string[] { "d23823" });
            }

            Tools.StartSetValue(start, (index + 1).ToString(), "");
            if (d1["uname"] != null)
            {
                name.text = (string)d1["uname"];
            }
            else
            {
                name.text = d1["uid"] + "";
            }

            if (d1["guild_name"] == null)
            {
                guild.text = Tools.GetMessageById("19955");
            }
            else
            {
                guild.text = d1["guild_name"] + "";
            }
            lv.text     = d1["lv"].ToString();
            achieve.url = userModel.GetRankImg((int)d1["like_num"]);
            rank.text   = d1["like_num"] + "";
        }
    }
Ejemplo n.º 28
0
    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"] + "";
    }
    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(() =>
            //{


            //});
        }
    }
Ejemplo n.º 30
0
    private void InitDate()
    {
        userModel = ModelManager.inst.userModel;
        roleModel = ModelManager.inst.roleModel;
        url       = (string)DataManager.inst.systemSimple["gps_url"];
        //lon = Convert.ToDouble(roleModel.longitude);
        //lat = Convert.ToDouble(roleModel.latitude);
        //addrDiction = (Dictionary<string, object>)DataManager.inst.systemSimple["area_config"];
        countryData = (Dictionary <string, object>)DataManager.inst.systemSimple["society_location"];
        loginType   = (object[])(DataManager.inst.systemSimple["login_icon"]);
        //loginTypeList = Tools.ConvertDicToList(loginType,"name");
        //Tools.Sort(loginTypeList, new string[] { "name:int:0" });

        //list_addr = new List<string>();
        list_age = new List <string>();
        //area = userModel.area;
        //addr = userModel.addr;

        //userModel.tel = "1";
        if (Tools.IsNullEmpty(userModel.tel))
        {
            obj_.visible = true;
            Dictionary <string, object> headIcon = (Dictionary <string, object>)userModel.head;
            head_Icon = head.GetChild("n0").asCom.GetChild("n0").asLoader;
//            head_Icon.url = ModelUser.GetHeadUrl(headIcon["use"].ToString());
            Tools.SetLoaderButtonUrl(null, ModelUser.GetHeadUrl(headIcon["use"].ToString()), head_Icon);
            head.GetChild("n2").asTextField.text = userModel.lv.ToString();
            loginList.itemRenderer = OnrenderLogin;
            loginList.numItems     = loginType.Length;
        }
        else
        {
            bg1.visible     = true;
            obj_.visible    = false;
            t1.visible      = true;
            textUid.visible = true;
            textUid.text    = userModel.uid.ToString();

            type_bing = Tools.GetUserTel(userModel.tel) [0];
            if (type_bing == Ex_Local.LOGIN_TYPE_QQ || type_bing == Ex_Local.LOGIN_TYPE_WEIXIN)
            {
                InitSex(1);
                //changeAccount.x = 377;
                //changeAccount.y = 456;
                child2.visible = true;
                //SetListAddr(comboxAddr_);
                if (userModel.uname != null)
                {
                    textName_.text = userModel.uname.ToString();
                }
                else
                {
                    textName_.text = userModel.uid.ToString();
                }
                switch (type_bing)
                {
                case Ex_Local.LOGIN_TYPE_QQ:
                    phone_.text = Tools.GetMessageById("33204");
                    break;

                case Ex_Local.LOGIN_TYPE_WEIXIN:
                    phone_.text = Tools.GetMessageById("33205");
                    break;
                }

                maskqq.visible = true;
            }
            else
            {
                //changeAccount.y = 456;
                //changeAccount.x = 200;
                child1.visible       = true;
                changePasswd.visible = true;
                //SetListAddr(comboxAddr);
                //InitAge();
                InitSex(2);
                string tel = Tools.GetUserTel(userModel.tel)[1];
                if (!Tools.IsNullEmpty(tel))
                {
                    string old = tel.Substring(3, 4);
                    tel        = tel.Replace(old, "****");
                    phone.text = tel;
                }
                if (userModel.uname != null)
                {
                    textName.text = userModel.uname.ToString();
                }
                else
                {
                    textName.text = userModel.uid.ToString();
                }
                maskPhon.visible = true;
            }
        }
    }