예제 #1
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"));
        }
    }
예제 #2
0
    private void Tab_Change()
    {
        int card_group_index = (int)userModel.records ["card_group_index"];

        if (card_group_index != c1.selectedIndex)
        {
            Debug.Log("card_group_index " + card_group_index);
            NetHttp.inst.Send(NetBase.HTTP_ALTER_CARD_GROUP_INDEX, "index=" + c1.selectedIndex, OnChangeCardCurrGroup);
        }
        long tim = DateTime.Now.Ticks;

        cardModel.teamIndex = c1.selectedIndex;
        cardModel.UpdataMyCardData();

        cardMove = true;
        OnClearChangeHandler();
        cardMove = false;
        this.GetChild("n3").asButton.GetChild("title").asTextField.strokeColor = c1.selectedIndex == 0?Tools.GetColor("6aa965"):Tools.GetColor("1a91e5");
        this.GetChild("n4").asButton.GetChild("title").asTextField.strokeColor = c1.selectedIndex == 1?Tools.GetColor("6aa965"):Tools.GetColor("1a91e5");
        this.GetChild("n5").asButton.GetChild("title").asTextField.strokeColor = c1.selectedIndex == 2?Tools.GetColor("6aa965"):Tools.GetColor("1a91e5");

        Dictionary <string, object> big = (Dictionary <string, object>)cfg ["show_attr"];

        this.GetChild("n35").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shuxing1");
        this.GetChild("n36").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shuxing2");
        this.GetChild("n37").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shuxing3");
        this.GetChild("n38").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shuxing4");
        this.GetChild("n39").asCom.GetChild("n0").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_shuxing5");

        this.GetChild("n35").asCom.GetChild("n1").asCom.data = this.GetChild("n35").asCom.GetChild("n1").asCom.width;
        this.GetChild("n36").asCom.GetChild("n1").asCom.data = this.GetChild("n36").asCom.GetChild("n1").asCom.width;
        this.GetChild("n37").asCom.GetChild("n1").asCom.data = this.GetChild("n37").asCom.GetChild("n1").asCom.width;
        this.GetChild("n38").asCom.GetChild("n1").asCom.data = this.GetChild("n38").asCom.GetChild("n1").asCom.width;
        this.GetChild("n39").asCom.GetChild("n1").asCom.data = this.GetChild("n39").asCom.GetChild("n1").asCom.width;

        this.GetChild("n35").asCom.GetChild("n1").asCom.width = (cardModel.GetHPTeam(c1.selectedIndex) / (int)big ["hp_score_max"]) * 94;
        this.GetChild("n36").asCom.GetChild("n1").asCom.width = (cardModel.GetAtkTeam(c1.selectedIndex) / (int)big ["atk_score_max"]) * 94;
        this.GetChild("n37").asCom.GetChild("n1").asCom.width = (cardModel.GetMoveTeam(c1.selectedIndex) / (int)big ["move_score_max"]) * 94;
        this.GetChild("n38").asCom.GetChild("n1").asCom.width = (cardModel.GetSpecTeam(c1.selectedIndex) / (int)big ["special_score_max"]) * 94;
        this.GetChild("n39").asCom.GetChild("n1").asCom.width = (cardModel.GetCostTeam(c1.selectedIndex) / (int)big ["cost_score_max"]) * 94;
        for (int i = 35; i < 40; i++)
        {
            GComponent img = this.GetChild("n" + i).asCom.GetChild("n1").asCom;
            float      wid = img.width;
            if (wid > 94)
            {
                wid = 94;
            }
            float c = (float)img.data;
            img.width = c;
            DOTween.To(() => c, x => c = x, wid, 0.5f).OnUpdate(() =>
            {
                img.width = c;
            });
        }


        list.numItems           = cardModel.myCard.Count;
        list.foldInvisibleItems = true;
        list.ResizeToFit(cardModel.myCard.Count);

        if (cardModel.myCard.Count == 0)
        {
            this.GetChild("n34").visible = false;
        }
        else
        {
            this.GetChild("n34").visible = true;
        }

        list2.y = list.y + list.height + 30;
//		gui1.y = list2.y - 25;

        list2.numItems           = cardModel.noMyCard.Count;
        list2.foldInvisibleItems = true;
        list2.ResizeToFit(cardModel.noMyCard.Count);

        this.GetChild("n34").height = list2.y - this.GetChild("n34").y - 15;
        this.height = 640;
//		this.scrollPane.viewHeight -= 30;
        this.height -= 138;
//		this.height += (ModelManager.inst.gameModel.height - 640) / 2;
        this.GetChild("n45").y = this.GetChild("n31").y + this.GetChild("n31").height;
//		this.y = cardModel.v2.y;
//		Log.debug (view.viewHeight + "|" + view.height+"|"+ModelManager.inst.gameModel.height);
    }