Example #1
0
    public void ShowDamageAmountEffect(Vector3 pos, int value)
    {
        GameObject go = mResLoader.Instantiate("ZhiboMode2/DamageNumber", root);
        Text       t  = go.GetComponentInChildren <Text>();

        if (value >= 0)
        {
            t.text  = "+" + value;
            t.color = Color.green;
        }
        else
        {
            t.text  = value + "";
            t.color = Color.red;
        }

        go.transform.position = pos;
        float   time      = 1.5f;
        Vector3 TargetPos = pos + Vector3.up * time * 1f;

        DOTween.To
        (
            () => go.transform.position,
            (x) => go.transform.position = x,
            TargetPos,
            time
        ).OnComplete(delegate()
        {
            mResLoader.ReleaseGO("ZhiboMode2/DamageNumber", go);
        });
    }
Example #2
0
    public override void BindView()
    {
        view.Close = root.Find("Close").GetComponent <Button>();

        view.ItemContainer = root.Find("ItemContainer");
        view.DetailPanel   = root.Find("DetailPanel");

        view.DetailDesp       = view.DetailPanel.Find("DetailDesp").GetComponent <Text>();
        view.DetailName       = view.DetailPanel.Find("DetailName").GetComponent <Text>();
        view.DetailEffectDesp = view.DetailPanel.Find("DetailEffectDesp").GetComponent <Text>();

        view.NextPage = root.Find("Next").GetComponent <Button>();
        view.PrePage  = root.Find("Pre").GetComponent <Button>();
        view.PageNum  = root.Find("PageNum").GetComponent <Text>();

        view.ConfirmBuyView = root.Find("确认购买").GetComponent <Image>();
        view.ConfirmBuy     = view.ConfirmBuyView.transform.Find("Confirm").GetComponent <Button>();
        view.ConfirmCancel  = view.ConfirmBuyView.transform.Find("Cancel").GetComponent <Button>();

        //view.Buy = root.Find("Buy").GetComponent<Button>();


        foreach (TaobaoItemView vv in view.ItemList)
        {
            pResLoader.ReleaseGO("UI/Apps/TaobaoItem", vv.root.gameObject);
        }

        view.ItemList.Clear();

        for (int i = 0; i < PageFixItemNum; 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);
            int idx = i;
            vv.root.gameObject.SetActive(false);
            {
                DragEventListener listener = vv.ItemBG.gameObject.GetComponent <DragEventListener>();
                if (listener == null)
                {
                    listener = vv.ItemBG.gameObject.AddComponent <DragEventListener>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    //ChooseOne(vv);
                    BuyOne(vv);
                };
                listener.PointerEnterEvent += delegate {
                    ShowPopupInfo(idx);
                    //idx
                };
                listener.PointerExitEvent += delegate {
                    HidePopupInfo(idx);
                };
            }
        }
    }
Example #3
0
    public void ShowDanmuEffect(Vector3 pos)
    {
        GameObject go = mResLoader.Instantiate("Zhibo/Effect", root);

        go.transform.position = pos;
        float time = (view.ScoreValue.transform.position - go.transform.position).magnitude / 10f;

        DOTween.To
        (
            () => go.transform.position,
            (x) => go.transform.position = x,
            view.ScoreValue.transform.position,
            time
        ).OnComplete(delegate()
        {
            mResLoader.ReleaseGO("Zhibo/Effect", go);
        });
    }
Example #4
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;
        }
    }
Example #5
0
    public void switchSelectedStory(int idx)
    {
        if (nowIdx == idx)
        {
            return;
        }
        foreach (RoleItemView roleView in view.roleList)
        {
            roleView.chooseHint.enabled = false;
        }
        view.roleList [idx].chooseHint.enabled = true;
        //view.properies.SetPointValues (new int[]{Random.Range(10,20),Random.Range(10,20),Random.Range(10,20),Random.Range(10,20),Random.Range(10,20)});
        nowIdx = idx;

        RoleStoryAsset ret = pResLoader.LoadResource <RoleStoryAsset> ("Roles/role" + idx);

        if (ret != null)
        {
            view.DetailName.text = ret.Name;
            view.DetailDesp.text = "";
            foreach (string ss in ret.specialList)
            {
                view.DetailDesp.text += ss + "\n";
            }
            view.InitMoney.text = ret.initMoney + "";
            view.InitAttr.text  = ret.initFreePoint + "";
            view.InitSkill.text = ret.initSkillPoint + "";

            view.properies.SetPointValues(ret.initProperties);


            for (int i = 0; i < view.extraInfoList.Count; i++)
            {
                pResLoader.ReleaseGO("UI/Role/extra", view.extraInfoList[i].root.gameObject);
            }
            view.extraInfoList.Clear();

            for (int i = 0; i < ret.initOwning.Count; i++)
            {
                ExtraInfoView vv = new ExtraInfoView();
                GameObject    go = pResLoader.Instantiate("UI/Role/extra", view.extraContainer);
                vv.BindView(go.transform);
                view.extraInfoList.Add(vv);
            }
        }
    }
Example #6
0
    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;
        }
    }
Example #7
0
 public void RecycleCard(GameObject go)
 {
     //GameObject.Destroy(go);
     mResLoader.ReleaseGO("Zhibo/Card", go);
 }
Example #8
0
 private void AutoDisappear(SuperDanmu danmu)
 {
     mResLoader.ReleaseGO("Zhibo/SuperDanmu", danmu.gameObject);
 }
Example #9
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);
        }
    }
Example #10
0
 public void RecycleCard(GameObject go)
 {
     mResLoader.ReleaseGO("Zhibo/Card", go);
 }
Example #11
0
 public void RemoveBuff(ZhiboBuff obj)
 {
     gameMode.state.ZhiboBuffs.Remove(obj);
     mResLoader.ReleaseGO("Zhibo/Buff", obj.gameObject);
     //CalculateBuffExtras();
 }
Example #12
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();
    }
Example #13
0
 public void RecycleDanmu(DanmuMode2 danmu)
 {
     mResLoader.ReleaseGO("ZhiboMode2/Danmu2", danmu.gameObject);
 }