Пример #1
0
    private void List_Render(int index, GObject go)
    {
        GButton btn_go = go.asCom.GetChild("n0").asButton;

        if (index == 0 || index % 2 == 0)
        {
            btn_go.alpha = 0;
        }
        else
        {
            btn_go.alpha = 1;
        }


        GButton    img_icon    = go.asCom.GetChild("n1").asButton;
        GLoader    img_rank    = go.asCom.GetChild("n10").asCom.GetChild("n1").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("n10").asCom.GetChild("n2").asTextField;
        GTextField l_job       = go.asCom.GetChild("n6").asTextField;
        GTextField l_guildCoin = go.asCom.GetChild("n7").asTextField;
        GButton    btn_set     = go.asCom.GetChild("n8").asButton;
        GTextField ranktxt     = go.asCom.GetChild("n18").asCom.GetChild("n4").asTextField;
        GLoader    pmStart     = go.asCom.GetChild("n18").asCom.GetChild("n1").asLoader;

        btn_go.GetChild("n2").asLoader.url = Tools.GetResourceUrl("Image2:n_bg_tanban6");
        if (index > lis.Count - 1)
        {
            img_icon.visible = false;
            img_rank.visible = false;
            l_name.visible   = false;
            go.asCom.GetChild("n3").visible = false;
            l_rank.visible      = false;
            l_job.visible       = false;
            l_guildCoin.visible = false;
            btn_set.visible     = false;
            ranktxt.visible     = false;
            pmStart.visible     = false;
            btn_go.touchable    = false;
            return;
        }
        else
        {
            img_icon.visible = true;
            img_rank.visible = true;
            l_name.visible   = true;
            go.asCom.GetChild("n3").visible = true;
            l_rank.visible      = true;
            l_job.visible       = true;
            l_guildCoin.visible = true;
            btn_set.visible     = true;
            ranktxt.visible     = true;
            pmStart.visible     = true;
            btn_go.touchable    = true;
        }

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

        ranktxt.text = Tools.StartValueTxt((index + 1));         //.ToString ();
        if (guildModel.my_guild_job == 3 || ModelManager.inst.userModel.uid == _data ["id"].ToString() || guildModel.my_guild_job >= (int)_data ["gradation"])
        {
            btn_set.visible = false;
        }
        else
        {
            btn_set.visible = true;
        }
        pmStart.url         = Tools.GetResourceUrl("Image2:n_icon_paiming4");
        ranktxt.strokeColor = Tools.GetColor("426600");
        switch ((index + 1))
        {
        case 1:
            ranktxt.strokeColor = Tools.GetColor("9b5c04");
            pmStart.url         = Tools.GetResourceUrl("Image2:n_icon_paiming1");
            break;

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

        case 3:
            ranktxt.strokeColor = Tools.GetColor("853c1d");
            pmStart.url         = Tools.GetResourceUrl("Image2:n_icon_paiming3");
            break;
        }

        if (ModelManager.inst.userModel.uid == _data ["id"].ToString())
        {
            btn_go.GetChild("n2").asLoader.url = Tools.GetResourceUrl("Image2:n_bg_tanban6_");
            btn_go.alpha = 1;
        }
        else
        {
        }
        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));


        if (_data ["uname"] == null)
        {
            l_name.text = _data ["id"].ToString();
        }
        else
        {
            l_name.text = _data ["uname"].ToString();
        }

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

        btn_set.RemoveEventListeners();
        btn_set.onClick.Add(() =>
        {
            MediatorSetGradation.uid = _data ["id"].ToString();
            removegg();

            Vector2 v2 = Stage.inst.touchPosition;
            v2.x       = Tools.offectSetX(v2.x);
//			Vector3 v3 = new Vector3 ((list.x * Tools.GetStageScale ().x) + 860, (list.y * Tools.GetStageScale ().y) + go.y + list.container.y + 134, list.z);
            MediatorSetGradation bbb = ViewManager.inst.ShowView <MediatorSetGradation>(false) as MediatorSetGradation;
            v2 = this.parent.GlobalToLocal(v2);
//			bbb.view.Center= new Vector2(0f,0f);
            bbb.group.x = v2.x - bbb.group.width - 15;
            bbb.group.y = v2.y - bbb.group.height / 2 + 15;
//			bbb.group.x = 0f;
//			bbb.group.y = 0f;
        });

        btn_go.RemoveEventListeners();
        btn_go.onClick.Add(() =>
        {
            Dictionary <string, object> dd = new Dictionary <string, object> ();
            dd ["fuid"] = _data ["id"];
//			roleModel.tab_Role_Select2 = 1;
            NetHttp.inst.Send(NetBase.HTTP_FUSERGET, dd, (VoHttp vo) =>
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, _data["id"], ModelManager.inst.roleModel.tab_CurSelect1, ModelManager.inst.roleModel.tab_CurSelect2, ModelManager.inst.roleModel.tab_CurSelect3 }));
            });
        });
    }