Exemple #1
0
    public void ShowItems()
    {
        foreach (TaobaoItemView vv in view.ItemList)
        {
            pResLoader.ReleaseGO("UI/Apps/TaobaoItem", vv.root.gameObject);
        }
        view.ItemList.Clear();
        preItemView = null;

        List <TaobaoItemInfo> fakeList = new List <TaobaoItemInfo>();

        {
            fakeList.Add(new TaobaoItemInfo("1"));
        }

        {
            fakeList.Add(new TaobaoItemInfo("2"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("3"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("4"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("s"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("4ss"));
        }
        for (int i = 0; i < fakeList.Count; i++)
        {
            TaobaoItemInfo info = fakeList[i];
            GameObject     go   = pResLoader.Instantiate("UI/Apps/TaobaoItem", view.ItemContainer);
            TaobaoItemView vv   = new TaobaoItemView();
            vv.BindView(go.transform);
            view.ItemList.Add(vv);
            vv.Hint.gameObject.SetActive(false);
            {
                ClickEventListerner listener = vv.ItemBG.gameObject.GetComponent <ClickEventListerner>();
                if (listener == null)
                {
                    listener = vv.ItemBG.gameObject.AddComponent <ClickEventListerner>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    ChooseOne(vv);
                };
            }

            vv.ItemName.text = info.Name;
        }
    }
Exemple #2
0
    private void RegisterEvent()
    {
        ClickEventListerner listener = view.Icon.gameObject.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = view.Icon.gameObject.AddComponent <DragEventListener>();
        }
        listener.ClearClickEvent();
        listener.OnClickEvent += delegate(PointerEventData eventData) {
            Clicked();
        };
    }
Exemple #3
0
    public void RegisterEvent()
    {
        ClickEventListerner listener = root.gameObject.GetComponent <ClickEventListerner>();

        if (listener == null)
        {
            listener = root.gameObject.AddComponent <ClickEventListerner>();
        }
        listener.ClearClickEvent();
        listener.OnClickEvent += delegate
        {
            pSkillCtrl.SelectSkill(this.SkillId);
        };
    }
Exemple #4
0
    // Use this for initialization
    public void Init(SkillItem baseItem)
    {
        this.baseItem = baseItem;

        ClickEventListerner listener = GetComponent <ClickEventListerner>();

        if (listener == null)
        {
            listener = gameObject.AddComponent <ClickEventListerner>();
        }
        listener.ClearClickEvent();
        listener.OnClickEvent += delegate
        {
            baseItem.Click(SkillId);
        };
    }
Exemple #5
0
    public override void RegisterEvent()
    {
        {
            ClickEventListerner listener = view.Actions.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = view.Actions.gameObject.AddComponent <ClickEventListerner>();
            }
            listener.ClearClickEvent();
            listener.OnClickEvent += delegate {
                Debug.Log(gameMode.state.CardDeck);
            };
        }

        view.NextTurnBtn.onClick.AddListener(delegate {
            NextTurn();
        });
    }
Exemple #6
0
    public void AddMsg(TurnMsg msg)
    {
        model.Msgs.Add(msg);
        GameObject go = pResLoader.Instantiate("UI/Main/e0", view.EventsContainer);
        EventView  vv = new EventView();

        vv.BindView(go.transform);
        ClickEventListerner listerner = vv.icon.gameObject.GetComponent <ClickEventListerner>();

        if (listerner == null)
        {
            listerner = vv.icon.gameObject.AddComponent <ClickEventListerner>();
        }
        listerner.ClearClickEvent();
        listerner.OnClickEvent += delegate
        {
            mUIMgr.ShowMsgBox(msg.content);
            RemoveMsg(msg);
        };
        view.EventViewList.Add(vv);
    }
Exemple #7
0
    public void BindView()
    {
        rt          = (RectTransform)transform;
        Expands     = transform.Find("Expand").gameObject;
        ExpandGroup = Expands.GetComponent <CanvasGroup>();
        Lines       = Expands.transform.Find("Lines");
        Subskills   = Expands.transform.Find("Tabs");

        Icon = transform.Find("BaseIcon").GetComponent <Image>();

        ClickEventListerner listener = Icon.gameObject.GetComponent <ClickEventListerner>();

        if (listener == null)
        {
            listener = Icon.gameObject.AddComponent <ClickEventListerner>();
        }
        listener.ClearClickEvent();
        listener.OnClickEvent += delegate
        {
            pSkillCtrl.ChooseBaseSkill(this);
        };
    }
Exemple #8
0
    public override void RegisterEvent()
    {
        view.Settings.onClick.AddListener(delegate
        {
            gameMode.OpenSetting();
        });
        {
            ClickEventListerner listener = view.Actions.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = view.Actions.gameObject.AddComponent <ClickEventListerner>();
            }
            listener.ClearClickEvent();
            listener.OnClickEvent += delegate {
                Debug.Log(gameMode.state.CardDeck);
            };
        }

        view.NextTurnBtn.onClick.AddListener(delegate {
            NextTurn();
        });


        view.RoleSkill.onClick.AddListener(delegate
        {
            gameMode.UseRoleSkill(0);
        });

        view.RoleSkill2.onClick.AddListener(delegate
        {
            gameMode.UseRoleSkill(1);
        });

        view.OpenGift.onClick.AddListener(delegate
        {
            gameMode.AddCardFromGift();// gainCard;
            CloseGift();
        });
    }
    private void ShowCards()
    {
        List <CardInfo> infos = pCardMgr.GetAllCards();


        foreach (CardOutView vv in view.CardsViewList)
        {
            pResLoader.ReleaseGO("UI/Card", vv.root.gameObject);
        }
        view.CardsViewList.Clear();
        preCardView        = null;
        model.NowCardInfos = infos;
        foreach (CardInfo c in infos)
        {
            GameObject  go          = pResLoader.Instantiate("UI/Card", view.CardsContainer);
            CardOutView cardOutView = new CardOutView();
            cardOutView.BindView(go.transform);
            view.CardsViewList.Add(cardOutView);
            cardOutView.Hint.gameObject.SetActive(false);

            {
                ClickEventListerner listener = cardOutView.CardFace.gameObject.GetComponent <ClickEventListerner>();
                if (listener == null)
                {
                    listener = cardOutView.CardFace.gameObject.AddComponent <ClickEventListerner>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    ShowCardDetail(cardOutView);
                };
            }

            CardAsset ca = pCardMgr.GetCardInfo(c.CardId);
            cardOutView.Name.text = ca.CardName;
            cardOutView.Desp.text = ca.CardEffectDesp;
        }
    }
Exemple #10
0
    private void UpdateCards(List <CardInfo> infos)
    {
        foreach (CardOutView vv in view.CardsViewList)
        {
            pResLoader.ReleaseGO("UI/CardOut", vv.root.gameObject);
        }
        view.CardsViewList.Clear();
        preCardView        = null;
        model.NowCardInfos = infos;
        foreach (CardInfo c in infos)
        {
            GameObject  go          = pResLoader.Instantiate("UI/CardOut", view.CardsContainer);
            CardOutView cardOutView = new CardOutView();
            cardOutView.BindView(go.transform);
            view.CardsViewList.Add(cardOutView);
            cardOutView.Hint.gameObject.SetActive(false);

            {
                ClickEventListerner listener = cardOutView.CardFace.gameObject.GetComponent <ClickEventListerner>();
                if (listener == null)
                {
                    listener = cardOutView.CardFace.gameObject.AddComponent <ClickEventListerner>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    ShowCardDetail(cardOutView);
                };
            }

            CardAsset ca = pCardMgr.GetCardInfo(c.CardId);
            cardOutView.Name.text = ca.CardName;
            cardOutView.Desp.text = ca.CardEffectDesp;
            cardOutView.Cost.text = ca.cost + "";

            cardOutView.NamePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardName/" + ca.CatdImageName);

            switch (ca.CardType)
            {
            case eCardType.GENG:
                cardOutView.Cover.sprite       = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Geng");
                cardOutView.Bg.sprite          = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Geng");
                cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Geng");
                Color nowColor1 = Color.white;
                ColorUtility.TryParseHtmlString(CostColor[2], out nowColor1);      //color follow the type
                cardOutView.Cost.color = nowColor1;
                break;

            case eCardType.ABILITY:
                cardOutView.Cover.sprite       = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Ability");
                cardOutView.Bg.sprite          = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Ability");
                cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Ability");
                Color nowColor2 = Color.white;
                ColorUtility.TryParseHtmlString(CostColor[1], out nowColor2);      //color follow the type
                cardOutView.Cost.color = nowColor2;
                break;

            case eCardType.ITEM:
                cardOutView.Cover.sprite       = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Item");
                cardOutView.Bg.sprite          = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Item");
                cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Item");
                Color nowColor3 = Color.white;
                ColorUtility.TryParseHtmlString(CostColor[0], out nowColor3);      //color follow the type
                cardOutView.Cost.color = nowColor3;
                break;
            }


            cardOutView.DaGou.SetActive(!c.isDisabled);
            if (ca.CatdImageName == null || ca.CatdImageName == string.Empty)
            {
                cardOutView.Picture.sprite = ca.Picture;
            }
            else
            {
                cardOutView.Picture.sprite = pResLoader.LoadResource <Sprite>("CardImage/" + ca.CatdImageName);
            }
            //Debug.Log(ca.Picture.name);
        }
    }
Exemple #11
0
    public void SwitchChoose(int newTab)
    {
        if (newTab == -1 || model.nowTab == newTab)
        {
            return;
        }


        model.nowTab = newTab;


        for (int i = 0; i < view.TypeTabGroup.tabs.Count; i++)
        {
            CardsTabView childView = view.TypeTabGroup.tabs[i] as CardsTabView;
            childView.BG.color = Color.white;
        }
        {
            CardsTabView childView = view.TypeTabGroup.tabs[newTab] as CardsTabView;
            childView.BG.color = Color.red;
        }

        List <string> skills = new List <string>();

        if (newTab == 0)
        {
            skills = pSkillMgr.GetSkillByType("common");
        }
        else if (newTab == 1)
        {
            skills = pSkillMgr.GetSkillByType("quality");
        }
        else if (newTab == 2)
        {
            skills = pSkillMgr.GetSkillByType("caiyi");
        }
        else if (newTab == 3)
        {
            skills = pSkillMgr.GetSkillByType("game");
        }
        model.NowSkills = skills;
        foreach (SkillItemView vv in view.SkillViewList)
        {
            resLoader.ReleaseGO("UI/Schedule/ScheduleItem", vv.root.gameObject);
        }
        view.SkillViewList.Clear();


        foreach (string sid in skills)
        {
            SkillAsset sa = pSkillMgr.GetSkillAsset(sid);

            GameObject    go = resLoader.Instantiate("UI/Schedule/ScheduleItem", view.ChoicesContainer);
            SkillItemView vv = new SkillItemView();
            vv.BindView(go.transform);
            vv.Title.text = sa.SkillName;
            view.SkillViewList.Add(vv);
            vv.Unselect();

            ClickEventListerner listener = vv.Icon.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = vv.Icon.gameObject.AddComponent <ClickEventListerner>();
            }
            listener.ClearClickEvent();
            listener.OnClickEvent += delegate {
                SelectSkill(vv);
            };
        }

        HideDetail();
    }