Example #1
0
    private void List_Render1(int index, GObject ss)
    {
        ComCard go = ss.asCom.GetChild("n0") as ComCard;

        go.ClearTime();
        ss.pivot = new Vector2(0.5f, 0.5f);
        if (cardMove)
        {
            ss.scale = new Vector2(1.25f, 1.25f);
            ss.alpha = 0;
            ss.TweenScale(new Vector2(1f, 1f), 0.1f).SetDelay(index * 0.05f).OnStart(() => {
                ss.alpha = 1;
            });
        }
        go.onClick.Clear();
        go.onClick.Add(() =>
        {
            this.onListItemClick1(index);
            //point = ss.LocalToGlobal(new Vector2(ss.x, ss.y));
            //Debug.LogError(point);
            v2 = Stage.inst.touchPosition;
        });
        string id = (cardModel.getDataMyTeamData(c1.selectedIndex) [(index)]).ToString();

        go.SetData(id);
        if (doudoduodu)
        {
            isMove = true;
            LeenTwennOne(go);
        }
    }
Example #2
0
    private void List_Render(int index, GObject ss)
    {
        ComCard go = ss.asCom.GetChild("n0") as ComCard;

        go.ClearTime();
        go.onClick.Clear();
        ss.pivot = new Vector2(0.5f, 0.5f);
        Dictionary <string, object> card = cardModel.myCard [index] as Dictionary <string, object>;

        if ((int)card ["new"] == 1)
        {
            userModel.Add_Notice(go.asCom, new Vector2(125, 0));
        }
        else
        {
            userModel.Remove_Notice(go.asCom);
        }
        string id = card ["id"].ToString();

        go.SetData(id);
        go.onClick.Add(() =>
        {
            this.onListItemClick(index, go, (int)card ["new"]);
            v2 = Stage.inst.touchPosition;
        });
    }
Example #3
0
    private void Item_Render(int index, GObject go)
    {
        ComCard cc = go.asCom.GetChild("n0") as ComCard;

        cc.SetData(ld [index]);

        cc.RemoveEventListeners();
        cc.onClick.Add(() =>
        {
            chatModel.support_Id = ld [index].ToString();

            GObject[] os = list.GetChildren();
            foreach (GObject oo in os)
            {
                if (go == oo)
                {
                    oo.asCom.GetController("c1").selectedIndex = 1;
                }
                else
                {
                    oo.asCom.GetController("c1").selectedIndex = 0;
                }
            }
        });
    }
Example #4
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);

        c1   = this.GetController("c1");
        card = this.GetChild("n0").asCom.GetChild("n0") as ComCard;

//		iconbg_2 = this.GetChild ("n4").asLoader;
        icon_2 = this.GetChild("n4").asLoader;
        num_2  = this.GetChild("n15").asTextField;
    }
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_LOGINCARD, false);

        userModel = ModelManager.inst.userModel;
        chatModel = ModelManager.inst.chatModel;
        //
        this.GetChild("n17").asTextField.text = Tools.GetMessageById("25501");
        //
        listData = new List <object[]> ();
        Dictionary <string, object> data = (Dictionary <string, object>)userModel.records ["guild_support_logs"];

        this.GetChild("n7").text = Tools.GetMessageById("25502");
        this.GetChild("n9").text = Tools.GetMessageById("25503");

        card = this.GetChild("n8").asCom as ComCard;
        list = this.GetChild("n12").asList;
//		bar = this.GetChild ("n4").asCom as ComProgressBar;
//		bar.skin = ComProgressBar.BAR7;

        int count = 0;
        Dictionary <string, object> users = (Dictionary <string, object>)data ["data"];

        object[] obj;
        foreach (string n in users.Keys)
        {
            obj = new object[3];
            object[] ob = (object[])users [n];
            obj [0] = n;
            obj [1] = ob [0];
            obj [2] = ob [1];
            listData.Add(obj);
            count += Convert.ToInt32(obj [2]);
        }

        int max = chatModel.GetCardRequestCount(data ["cid"].ToString(), userModel.effort_lv);

//		bar.value = count;
//		bar.max = max;
        this.GetChild("n19").asTextField.text = count + "/" + max;
        CardVo vo = DataManager.inst.GetCardVo(data ["cid"].ToString());

        card.SetData(vo.id, 1, 1);
        card.SetText(Tools.GetMessageById(vo.name));

        this.GetChild("n11").text = vo.exp + "";       // + "/" + vo.maxExp;
        this.GetChild("n18").text = "/" + vo.maxExp;

        list.itemRenderer = Item_Render;
        list.SetVirtual();
        list.numItems = listData.Count;
    }
Example #6
0
        public ActionResult SetCard()
        {
            Game1R resultMode = Session["MODEL"] as Game1R;

            resultMode.IS_Error = "N";

            if (resultMode.GetCardRList.Where(o => o.IS_PICK == "Y").Count() == 3 &&
                resultMode.GetCardRList.Where(o => o.IS_PICK != "Y").Count() == 2)
            {
                foreach (GetCardR CardR in resultMode.GetCardRList.Where(o => o.IS_PICK == "Y"))
                {
                    if (CardR.IS_PICK == "Y")
                    {
                        UserCard userCardR = new UserCard();
                        userCardR.UserPlay = resultMode.UserPlay;
                        userCardR.Round    = resultMode.ROUND;
                        userCardR.Card     = CardR.Card;
                        resultMode.GetUserCardList.Add(userCardR);
                    }
                    else
                    {
                        ComCard ComCardR = new ComCard();
                        ComCardR.Round = resultMode.ROUND;
                        ComCardR.Card  = CardR.Card;
                        resultMode.GetComCardList.Add(ComCardR);
                    }
                }

                var result = CallApi <Game1R, Game1R>("Api/GAME/SetCard", resultMode);
                resultMode = result;
                if (resultMode.IS_Error == "N")
                {
                    resultMode.Status = "請配置卡片";
                }
            }
            else
            {
                resultMode.IS_Error = "Y";
            }

            DataContractJsonSerializer json = new DataContractJsonSerializer(resultMode.GetType());

            using (MemoryStream ms = new MemoryStream())
            {
                json.WriteObject(ms, resultMode);
                string ResultJson = Encoding.UTF8.GetString(ms.ToArray());
                return(Json(ResultJson));
            }
        }
Example #7
0
    private void OnRender(int index, GObject item)
    {
        item.scale = new Vector2(0.7f, 0.7f);
        object[] dc   = (object[])deck[index];
        ComCard  card = item as ComCard;

        CardVo v = DataManager.inst.GetCardVo(dc[0].ToString(), (int)dc[1]);

        card.SetData(v.id, -1, 2, v.lv);
        card.SetText(Tools.GetMessageById(v.name));
        card.onClick.Add(() => {
            //ViewManager.inst.ShowCardInfo(v.id, 3, v.lv);
            MediatorItemShipInfo2.CID = v.id;
            //MediatorItemShipInfo2.isKu = 3;
            MediatorItemShipInfo2.lv = v.lv;
            ViewManager.inst.ShowView <MediatorItemShipInfo2>();
        });
    }
Example #8
0
    private void Record_Render(int index, GObject item)
    {
        ///		["lv"]	1	System.Collections.DictionaryEntry
        //+       ["new"] 0   System.Collections.DictionaryEntry
        //+       ["exp"] 1   System.Collections.DictionaryEntry
        //+       ["name"]    "C007"  System.Collections.DictionaryEntry
        Dictionary <string, object> dc = (Dictionary <string, object>)data[index];
        //if (roleModel.otherInfo["uid"].Equals(userModel.uid))
        //{
        //    ComCard card = item as ComCard;
        //    CardVo v = DataManager.inst.GetCardVo(dc["name"].ToString());
        //    card.SetData(v.id, -1, 2);
        //    card.SetText(Tools.GetMessageById(v.name));
        //    item.onClick.Add(() =>
        //    {
        //        ViewManager.inst.ShowCardInfo(v.id, 4);
        //    });
        //}
        //else
        //{
        ComCard card = item as ComCard;
        CardVo  v    = DataManager.inst.GetCardVo(dc["name"].ToString(), (int)dc["lv"]);

        card.SetData(v.id, -1, 2, v.lv);
        card.SetText(Tools.GetMessageById(v.name));
        item.onClick.Add(() =>
        {
            //ViewManager.inst.ShowCardInfo(v.id, 3, v.lv);
            MediatorItemShipInfo2.CID = v.id;
            //MediatorItemShipInfo2.isKu = 3;
            MediatorItemShipInfo2.lv = v.lv;
            ViewManager.inst.ShowView <MediatorItemShipInfo2>();
        });

        //}
    }
Example #9
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_ITEMSHIP);
        cardModel = ModelManager.inst.cardModel;
        userModel = ModelManager.inst.userModel;
//		this.x = cardModel.v2.x;
        this.y = cardModel.v2.y;
//		Log.debug ("xxx-" + this.x + " yyy-" + this.y);
//		return;
//		view.x = 103;
//		view.y = 40;
//		view.width = ModelManager.inst.gameModel.width;
//		isFirst = true;
        cardModel.SetData();
        cfg            = DataManager.inst.systemSimple;
        userCard       = ModelManager.inst.userModel.card;
        oldred         = (int)userModel.records [Config.ASSET_REDBAGCOIN] < 0 ? 0 : (int)userModel.records [Config.ASSET_REDBAGCOIN];
        list           = this.GetChild("n28").asList; //Tools.FindChild<L_List> (this.thiss, "L_List");
        list1          = this.GetChild("n23").asList; //Tools.FindChild<L_List> (this.thiss, "L_ListZu");
        list2          = this.GetChild("n31").asList; //Tools.FindChild<L_List> (this.thiss, "L_List2");
        L_Label        = this.GetChild("n25").asTextField;
        l_mycardNum    = this.GetChild("n16").asTextField;
        c_card         = this.GetChild("n24") as ComCard;
        btn_clear      = this.GetChild("n26").asButton;
        btn_clear.text = Tools.GetMessageById("24126");
        btn_clear.onClick.Add(OnClearChangeHandler);
//		gui1 = this.GetChild ("n30").asImage;
//		gui0 = view.GetChild ("n29").asImage;
        this.GetChild("n25").asTextField.text = Tools.GetMessageById("24124");
        g_have    = this.GetChild("n27").asGroup;
        c1        = this.GetController("c1");
        cardinfo  = this.GetChild("n40").asGroup;
        cardGroup = this.GetChild("n47").asGroup;

        c1.onChanged.Add(Tab_Change);
        c1.onChangeTip.Add(Tab_ChangeTip);
        canChangeGroup = userModel.GetUnlcok(Config.UNLOCK_CARDGROUP, this.GetChild("n3").asButton);
        userModel.GetUnlcok(Config.UNLOCK_CARDGROUP, this.GetChild("n4").asButton);
        userModel.GetUnlcok(Config.UNLOCK_CARDGROUP, this.GetChild("n5").asButton);

        Dictionary <string, object> cfg1 = (Dictionary <string, object>)DataManager.inst.systemSimple ["unlock"];

        object[] i = (object[])cfg1 [Config.UNLOCK_CARDGROUP];
        msg = Tools.GetMessageById("14028", new string[] { i [0].ToString() });

        c1.changeObj.Add(this.GetChild("n3").asButton);
        c1.changeObj.Add(this.GetChild("n4").asButton);
        c1.changeObj.Add(this.GetChild("n5").asButton);

        list1.itemRenderer = List_Render1;
        list.itemRenderer  = List_Render;
        list2.itemRenderer = List_Render2;

        l_mycardNum.text = Tools.GetMessageColor(Tools.GetMessageById("17010", new string[] {
            userCard.Keys.Count + "",
            DataManager.inst.GetCardNumByLv(ModelManager.inst.userModel.effort_lv) + ""
        }), new string[] { "F8DD2CFF" });
        this.GetChild("n9").asTextField.text  = Tools.GetMessageById("24127");
        this.GetChild("n14").asTextField.text = Tools.GetMessageById("24128");

        IsChangeType(false);

        this.AddGlobalListener(MainEvent.CARD_CHANGE, OnChangeCallBack);
        this.AddGlobalListener(MainEvent.CARD_LEVELUP, OnlevelUp);
        this.AddGlobalListener(MainEvent.LEVEL_UP_USER, OnUserLevelup);
//		this.AddGlobalListener (MainEvent.JUMP_COINGOLDEXPGET, OnJumpFunction);

        if ((int)userModel.records ["card_group_index"] == 0)
        {
            Tab_Change();
        }
        else
        {
            c1.selectedIndex = (int)userModel.records ["card_group_index"];
        }
        cardModel.teamIndex = c1.selectedIndex;
        cardModel.UpdataMyCardData();

        if (GuideManager.inst.Check("1:0"))         //引导开始 升级卡牌
        {
            List_Render1(0, this.GetChild("n46"));
            GuideManager.inst.Next();
            GuideManager.inst.Show(this);
        }
//		else if(GuideManager.inst.Check ("2:0")){
//			GuideManager.inst.Clear ();
//			GuideManager.inst.Show (this);
//		}
        else
        {
            this.RemoveChild(this.GetChild("n46"));
        }
    }
 public void Setup()
 {
     gameObject.SetActive(true);
     ComCard.Setup();
     _buildingMenu.Setup();
 }
Example #11
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 ();
    }
Example #12
0
    public override void Init()
    {
        base.Init();
        cfg = (Dictionary <string, object>)cfg ["daily_box"];
        this.Create(Config.VIEW_GETDAYCARDBOX, false, Tools.GetMessageById(cfg["name"].ToString()));

        userdata = (Dictionary <string, object>)userdata ["daily_box"];
        gold1    = ModelManager.inst.userModel.gold;
        card1    = this.GetChild("n27") as ComCard;
        card2    = this.GetChild("n28") as ComCard;
        card3    = this.GetChild("n29") as ComCard;
        l_info   = this.GetChild("n17").asTextField;
        l_coin   = this.GetChild("n20").asTextField;

        btn_buy = this.GetChild("n18").asButton;
        btn_buy.onClick.Add(OnBuyHandler);

        this.GetChild("n12").asTextField.text = Tools.GetMessageById("17017");
        this.GetChild("n30").asTextField.text = Tools.GetMessageById("17019");
//		GameObjectScaler.Scale(EffectManager.inst.AddPrefab (Tools.GetExploreBoxID (cfg ["picture"].ToString ()), this.GetChild ("n13").asGraph),0.7f);
        EffectManager.inst.AddPrefab(Tools.GetExploreBoxID(cfg ["picture"].ToString()), this.GetChild("n13").asGraph).transform.localScale *= 0.65f;
        Dictionary <string, object> cardcfg = DataManager.inst.card;

        object[] arr = userdata ["card_class"] as object[];
        for (int i = 0; i < arr.GetLength(0); i++)
        {
            object[] array = (object[])arr [i];
            CardVo   ca    = DataManager.inst.GetCardVo((string)array [0]);
            switch (i)
            {
            case 0:
                card1.SetData((string)array [0], -1, 4);
                card1.SetText(Tools.GetMessageById(((Dictionary <string, object>)cardcfg [(string)array [0]]) ["name"].ToString()));
                card1.name = (string)array [0];
                break;

            case 1:
                card2.SetData((string)array [0], -1, 4);
                card2.SetText(Tools.GetMessageById(((Dictionary <string, object>)cardcfg [(string)array [0]]) ["name"].ToString()));
                card2.name = (string)array [0];
                break;

            case 2:
                card3.SetData((string)array [0], -1, 4);
                card3.SetText(Tools.GetMessageById(((Dictionary <string, object>)cardcfg [(string)array [0]]) ["name"].ToString()));
                card3.name = (string)array [0];
                break;
            }
        }
        card1.onClick.Add((EventContext ev) => {
            MediatorItemShipInfo2.CID = ((ComCard)ev.sender).name;
//			MediatorItemShipInfo2.isKu = 2;
            ViewManager.inst.ShowView <MediatorItemShipInfo2>();
        });
        card2.onClick.Add((EventContext ev) => {
            MediatorItemShipInfo2.CID = ((ComCard)ev.sender).name;
//			MediatorItemShipInfo2.lv = 10;
//			MediatorItemShipInfo.isKu = 2;
            ViewManager.inst.ShowView <MediatorItemShipInfo2>();
        });
        card3.onClick.Add((EventContext ev) => {
            MediatorItemShipInfo2.CID = ((ComCard)ev.sender).name;
//			MediatorItemShipInfo.isKu = 2;
            ViewManager.inst.ShowView <MediatorItemShipInfo2> ();
        });


        l_info.text = Tools.GetMessageById("17009", new string[] { ((object[])cfg ["num"])[0].ToString() });
//		view.GetChild ("n33").asButton.onClick.Add (() => {
//			ViewManager.inst.CloseView(this);
//		});
        coinUpdata();
        this.AddGlobalListener(MainEvent.DAY_BOX_FRUSH, OnBoxFrushFunction);
    }