Beispiel #1
0
    public void Open(int[] targets)
    {
        for (int i = 0, length = targets.Length; i < length; ++i)
        {
            GameObject       list = Instantiate(item, equip_sr.content);
            EquipTipItemView etv  = list.GetComponent <EquipTipItemView>();
            etv.SetView(targets[i]);
            int id = targets[i];
            EventListener.Get(etv.item_img.gameObject).OnClick = e =>
            {
                PlayerPrefs.SetInt("advancedtarget", id);
                UIFace.GetSingleton().Close(UIID.EuqipTipCtrl);
            };
            EventListener.Get(etv.item_img.gameObject).BegineDragEvent = e =>
            {
                equip_sr.OnBeginDrag(e);
            };
            EventListener.Get(etv.item_img.gameObject).EndDragEvent = e =>
            {
                equip_sr.OnEndDrag(e);
            };
            EventListener.Get(etv.item_img.gameObject).DragEvent = e =>
            {
                equip_sr.OnDrag(e);
            };
        }
        Vector2 size = equip_sr.content.sizeDelta;

        size.x = width * targets.Length + 15f;
        equip_sr.content.sizeDelta = size;
    }
 public void Affirm(bool rename)
 {
     if (rename)
     {
         if (JsonMgr.GetSingleton().ExamineShieldWord(this.mView.Name_input.text))
         {
             if (Role.Instance.Gold > 100)
             {
                 Role.Instance.RoleName          = this.mView.Name_input.text;
                 this.mView.Placeholder_txt.text = this.mView.Name_input.text;
                 this.mView.Name_txt.text        = this.mView.Name_input.text;
                 Role.Instance.Gold -= 100;
             }
             else
             {
                 CanvasView.Instance.AddNotice("元宝不足,无法修改!");
             }
         }
         else
         {
             CanvasView.Instance.AddNotice("昵称内包含屏蔽字样,请修改!");
         }
     }
     UIFace.GetSingleton().Close(UIID.Tip);
     this.mView.ChangeName_obj.SetActive(false);
 }
Beispiel #3
0
 public void CreateFlagNode()
 {
     for (int flagidx = 0; flagidx < FlagCnt; ++flagidx)
     {
         if (flagidx >= flaglist.Count)
         {
             GameObject flagnodego = GameObject.Instantiate(flagnode.gameObject, flaglist_obj);
             int        flagid     = FlagStartId + flagidx;
             flagnodego.name = string.Format("flagnode_{0}", flagid);
             flagnodego.GetComponent <Image>().sprite = ResourceMgr.Instance.LoadSprite(flagid);
             flaglist.Add(flagnodego);
             EventListener.Get(flagnodego).OnClick = e =>
             {
                 ZEventSystem.Dispatch(EventConst.OnSelectFlag, flagid);
                 UIFace.GetSingleton().Close(UIID.FlagSelect);
             };
             EventListener.Get(flagnodego).BegineDragEvent = e =>
             {
                 flagscroll_obj.OnBeginDrag(e);
             };
             EventListener.Get(flagnodego).DragEvent = e =>
             {
                 flagscroll_obj.OnDrag(e);
             };
             EventListener.Get(flagnodego).EndDragEvent = e =>
             {
                 flagscroll_obj.OnEndDrag(e);
             };
         }
     }
     flaglist_obj.sizeDelta = new Vector2(FlagCnt * flagnode.sizeDelta.x, flaglist_obj.sizeDelta.y);
 }
Beispiel #4
0
    public void Init(bool open)
    {
        if (open)
        {
            //  ZEventSystem.Instance.Register(EventConst.OnMsgOnMain, this, "OnMain");
            this.mView.buy_btn.onClick.AddListener(delegate() {  });
            this.mView.operation_10_btn.onClick.AddListener(delegate() { });
            this.mView.operation_btn.onClick.AddListener(delegate() { });
            this.mView.embattle_btn.onClick.AddListener(delegate() { UIFace.GetSingleton().Open(UIID.Stub, 0); });
            this.mView.begin_btn.onClick.AddListener(delegate() { OpenCombat(); });
            //  this.mView.Woman1_tog.onValueChanged.AddListener((bool value) => this.mView.CutRole(false, this.mView.Woman1_tog.gameObject));
        }
        else
        {
            if (false == BattleMgr.Instance.isOff)
            {
                ZEventSystem.Dispatch(EventConst.OnClose);
            }

            this.mView.buy_btn.onClick.RemoveAllListeners();
            this.mView.operation_10_btn.onClick.RemoveAllListeners();;
            this.mView.operation_btn.onClick.RemoveAllListeners();;
            this.mView.embattle_btn.onClick.RemoveAllListeners();;
            this.mView.begin_btn.onClick.RemoveAllListeners();
            // this.mView.Woman_tog.onValueChanged.RemoveAllListeners();
        }
    }
Beispiel #5
0
    /// <summary>
    /// 点击刷新按钮
    /// </summary>
    public void ClickRefresh()
    {
        Debug.Log((int)ShopMgr.Instance.shoptype);
        int times = ShopMgr.Instance.shopRefreshTime[((int)ShopMgr.Instance.shoptype) - 1];
        int allPrice;

        if (times == 0)
        {
            allPrice = 50;
        }
        else
        {
            allPrice = refreshPrice * times;
        }
        TipCtrl ctrl = (TipCtrl)UIFace.GetSingleton().Open(UIID.Tip, 4, (allPrice.ToString()), "元宝", (times.ToString()));

        UIFace.GetSingleton().Open(UIID.Tip);
        ctrl.SetHandler(
            delegate()
        {
            ClickOk(false);
        },
            delegate()
        {
            ClickOk(true);
        }
            );
    }
 /// <summary>
 /// 招募高档单个
 /// </summary>
 public void ClickHighGradeBuyOne()
 {
     RecruitingMgr.Instance.type = (int)RecruitingType.HighOne;
     if (HighTimes == 1)
     {
         UIFace.GetSingleton().Open(UIID.RecruitingAward);
         ZEventSystem.Dispatch(EventConst.ShowOneLuckyDrawResults, RecruitingMgr.Instance._item, (int)RecruitingType.HighOne);
         time = DateTime.Now.AddHours(1).ToString();
         ShowHighGradeTime(true);
         return;
     }
     if (Role.Instance.Gold >= (int)LuckyDrawResoults.HUNITITEM)
     {
         UIFace.GetSingleton().Open(UIID.RecruitingAward);
         ZEventSystem.Dispatch(EventConst.ShowOneLuckyDrawResults, RecruitingMgr.Instance._item, (int)RecruitingType.HighOne);
         if (HighTimes == 0 && highgradebuyoneprice_txt.text != "免费")
         {
             Role.Instance.Gold -= (int)LuckyDrawResoults.HUNITITEM;
         }
         Debug.Log(Role.Instance.Gold);
     }
     else
     {
         CanvasView.Instance.AddNotice("钱不够!");
     }
 }
    public void SetView(TotemData data, int lv = 1)
    {
        if (data == null)
        {
            Color c = item_img.color;
            c.a            = 0;
            item_img.color = c;
            play_cr.SetAlpha(0);
            name_txt.text  = string.Format("<color=#FFFF00>{0}级</color>", lv);
            level_txt.text = "";
            return;
        }
        this.data = data;
        cr.SetAlpha(1);
        play_cr.SetAlpha(0);

        Color co = item_img.color;

        co.a            = 1;
        item_img.color  = co;
        item_img.sprite = ResourceMgr.Instance.LoadSprite(data.ItemData.icon);
        EventListener.Get(item_img.gameObject).OnClick = e =>
        {
            UIFace.GetSingleton().Open(UIID.DivinationTip, data, SHOWBUTTON.EtakeOff);
        };
        int    rare  = data.ItemData.rare;
        string color = ColorMgr.Colors[rare - 1];

        name_txt.text = string.Format("<color=#{0}>Lv.{1}\n {2}</color>", color, data.Level, data.TotemConfig.Name);
    }
Beispiel #8
0
    public void Open(TotemData td)
    {
        if (td == null)
        {
            return;
        }
        playExp             = 0;
        plusLevel           = 0;
        composeItem         = td;
        playItem_img.sprite = ResourceMgr.Instance.LoadSprite(td.ItemData.icon);
        ExpValue();
        name_txt.text = td.ItemData.name;
        SetAttrActive(false);

        st = tip_obj.GetComponent <ScaleTween>();
        st.AddOnFinished(delegate() { tip_obj.SetActive(false); });
        EventListener.Get(tip_btn.gameObject).OnClick = e =>
        {
            tip_obj.SetActive(true);
            st.ResetToBeginning();
            st.PlayForward();
        };
        EventListener.Get(close_btn.gameObject).OnClick = e =>
        {
            UIFace.GetSingleton().Close(UIID.CompostDivination);
        };
        SetPlayView();
        InitItem();
    }
Beispiel #9
0
    public static void OpenMonsterTip(Vector2 pos, int monsterId, bool isBoss, Alignment align, Vector2 offset)
    {
        UIFace.GetSingleton().Open(UIID.Tips);
        List <object> argWrapper = new List <object>();

        argWrapper.Add(isBoss);
        ZEventSystem.Dispatch(EventConst.OnOpenTips, (int)TipsType.MonsterTip, monsterId, pos, align, offset, argWrapper);
    }
Beispiel #10
0
 public void SetClick(int uiID)
 {
     if (maskSp != null)
     {
         EventListener.Get(maskSp.gameObject).OnClick = e =>
         {
             UIFace.GetSingleton().Close((UIID)uiID);
         };
     }
 }
Beispiel #11
0
 /// <summary>
 /// 点击商店刷新
 /// </summary>
 /// <param name="isOk"></param>
 public void ClickOk(bool isOk)
 {
     if (isOk)
     {
         ShopMgr.Instance.shopRefreshTime[((int)ShopMgr.Instance.shoptype) - 1]++;
         ShopMgr.Instance.OpenUnitShop((int)ShopMgr.Instance.shoptype, true);
         ZEventSystem.Dispatch(EventConst.RefreshTimes, (int)ShopMgr.Instance.shoptype);
     }
     UIFace.GetSingleton().Close(UIID.Tip);
 }
 private void initEvent(bool open)
 {
     if (open)
     {
         this.mView.close_btn.onClick.AddListener(() => { UIFace.GetSingleton().Close(UIID.PlayerInfo); });
     }
     else
     {
         this.mView.close_btn.onClick.RemoveAllListeners();
     }
 }
Beispiel #13
0
 void WesternEvent(int type, bool isRefresh)
 {
     ZEventSystem.Dispatch(EventConst.ShowNPC, type);
     if (false == ShopMgr.Instance.goodsList.ContainsKey(type) || isRefresh)
     {
         Client.Instance.Send(ServerMsgId.CCMD_OPEN_SHOP, null, (short)type, Role.Instance.RoleId);
     }
     else
     {
         UIFace.GetSingleton().Open(UIID.ShopItem);
     }
 }
Beispiel #14
0
    public void Open(int heroId)
    {
        heroData = HeroMgr.GetSingleton().GetHeroData(heroId);

        SetHeadView();

        long exp = Role.Instance.ExpPool;

        exp_txt.text = exp.ToString("N0");
        tempLv       = heroData.Level;

        if (exp < heroData.NeedHero || heroData.Level == HeroMgr.MaxHeroLevel)
        {
            levelup_btn.interactable = false;
            expend_txt.text          = heroData.NeedHero.ToString("N0");
            targetLv_txt.text        = tempLv.ToString();
            return;
        }
        levelup_btn.interactable = true;

        do
        {
            cost = ComputerExpend();
            if (cost > exp)
            {
                tempLv--;
                cost = ComputerExpend();
                break;
            }
            if (tempLv == HeroMgr.MaxHeroLevel)
            {
                break;
            }
            tempLv++;
        } while (tempLv <= HeroMgr.MaxHeroLevel);

        expend_txt.text   = cost.ToString("N0");
        targetLv_txt.text = tempLv.ToString();

        EventListener.Get(levelup_btn.gameObject).OnClick = e =>
        {
            if (!levelup_btn.IsInteractable())
            {
                return;
            }
            Role.Instance.ExpPool -= cost;
            heroData.Level         = tempLv;
            Lv_txt.text            = heroData.Level.ToString();
            ZEventSystem.Dispatch(EventConst.REFRESHSIDE, false);
            exp_txt.text = Role.Instance.ExpPool.ToString("N0");
            UIFace.GetSingleton().Close(UIID.ExpPool);
        };
    }
Beispiel #15
0
 public void Logout(bool islogout)
 {
     if (islogout)
     {
         Client.Instance.Reset();
         SceneMgr.Instance.LoadScene("Login");
     }
     else
     {
         UIFace.GetSingleton().Close(UIID.Tip);
     }
 }
Beispiel #16
0
    public void Open(EquipData equip)
    {
        this.data = equip;
        int rare = equip.ItemData.rare;

        border_img.sprite = ResourceMgr.Instance.LoadSprite(ColorMgr.Border[rare - 1]);
        string color = ColorMgr.Colors[rare - 1];

        name_txt.text  = string.Format("<color=#{0}>{1}</color>", color, equip.JsonData.Name);
        state_txt.text = "";
        levle_txt.text = equip.StrengthenLv > 0 ? "+" + equip.StrengthenLv: "";
        lvfloor_cr.SetAlpha(equip.StrengthenLv);
        des_txt.text     = equip.ItemData.usedes;
        equip_img.sprite = ResourceMgr.Instance.LoadSprite(equip.ItemData.icon);
        EventListener.Get(strengthen_btn.gameObject).OnClick = e =>
        {
            UIFace.GetSingleton().Close(UIID.StrengthenTip);
            UIFace.GetSingleton().Open(UIID.Strengthen, equip);
        };
        StringBuilder sb = new StringBuilder();

        Pro[] p = equip.Attribute;
        for (int i = 0, length = p.Length; i < length; ++i)
        {
            sb.Append(AttrUtil.GetAttribute(p[i].attr));
            sb.Append(": +");
            sb.Append(AttrUtil.ShowText(p[i].attr, p[i].num, p[i].per));
            sb.Append("\n");
        }
        baseattr_txt.text = attr_txt.text = sb.ToString();
        //appendattr_obj.SetActive(equip.wishs.Length > 0);
        sb.Length = 0;
        for (int i = 0, length = equip.wishs.Length; i < length; ++i)
        {
            sb.Append(AttrUtil.GetAttribute(equip.wishs[i].wish.attr));
            sb.Append(": +");
            sb.Append(AttrUtil.ShowText(equip.wishs[i].wish.attr, equip.wishs[i].wish.num, equip.wishs[i].wish.per));
            sb.Append("\n");
        }
        appendattr_txt.text = equip.wishs.Length > 0 ? sb.ToString(): "<color=#FFFF00>提升装备品质\n开放更多属性</color>";
        p = equip.Innate;
        constattr_obj.SetActive(p.Length != 0);
        sb.Length = 0;
        for (int i = 0, length = p.Length; i < length; ++i)
        {
            sb.Append(AttrUtil.GetAttribute(p[i].attr));
            sb.Append(": +");
            sb.Append(AttrUtil.ShowText(p[i].attr, p[i].num, p[i].per));
            sb.Append("\n");
        }
        constattr_txt.text = sb.ToString();
        sb = null;
    }
Beispiel #17
0
 void OpenWesternShop()
 {
     ShopMgr.Instance.shoptype = ShopType.westernshop;
     UIFace.GetSingleton().Open(UIID.ShopItem);
     if (!ShopMgr.Instance.goodsList.ContainsKey((int)ShopMgr.Instance.shoptype))
     {
         WesternEvent((int)ShopMgr.Instance.shoptype, true);
     }
     else
     {
         WesternEvent((int)ShopMgr.Instance.shoptype, false);
     }
 }
Beispiel #18
0
 public void Init(bool open)
 {
     if (open)
     {
         //this.mView.RoleFullLevel_btn.onClick.AddListener(delegate () { this.mView.RoleFullLevel(); }); //主公满级
         //this.mView.AddCopper_btn.onClick.AddListener(delegate() { this.mView.AddCopper(); }); //给铜钱
         //this.mView.ClearStage_btn.onClick.AddListener(delegate() {this.ClearsClose();  }); //解锁关卡
         //this.mView.AddPower_btn.onClick.AddListener(delegate() { this.mView.AddPower(); });//增加体力
         //this.mView.ElevateVIP_btn.onClick.AddListener(delegate() { this.mView.ElevateVIP(); });//提升VIP等级
         //this.mView.GeneralFullLevel_btn.onClick.AddListener(delegate() { this.mView.GeneralFullLevel(); });//武将满级
         //this.mView.AddGold_btn.onClick.AddListener(delegate() { this.mView.AddGold(); });//增加金锭
         //this.mView.ClearLeve_btn.onClick.AddListener(delegate() { Simulate(); });//解锁章节
         //this.mView.AddVigor_btn.onClick.AddListener(delegate() { this.mView.AddVigor(); });//增加精力
         //this.mView.Outfit_btn.onClick.AddListener(delegate () { this.mView.Outfit(); });//一键装备
         //this.mView.Advance500_btn.onClick.AddListener(delegate() { this.mView.Advance500(); }); //竞技场前进500名
         //this.mView.AddHonor_btn.onClick.AddListener(delegate() { this.mView.AddHonor(); }); //增加荣誉
         //this.mView.SkillFullLevel_btn.onClick.AddListener(delegate() { this.mView.SkillFullLevel(); });//技能满级
         //this.mView.Advance3_btn.onClick.AddListener(delegate() { this.mView.Advance3(); });//过关斩将前进3名
         //this.mView.Intensify_btn.onClick.AddListener(delegate() { this.mView.Intensify(); }); //一键强化
         //this.mView.AddActive_btn.onClick.AddListener(delegate() { this.mView.AddActive(); });  //活跃度增加20
         //this.mView.Divination_btn.onClick.AddListener(delegate() { this.mView.Divination(); });//一键卜卦
         //this.mView.Sophistication_btn.onClick.AddListener(delegate(){ this.mView.Sophistication(); });//一键洗练
         this.mView.Close_btn.onClick.AddListener(delegate() { UIFace.GetSingleton().Close(UIID.GM); });
         this.mView.Send_btn.onClick.AddListener(delegate() { this.mView.GMorder(this.mView.GMOrder_input.text); });
         //  this.mView.Woman1_tog.onValueChanged.AddListener((bool value) => this.mView.CutRole(false, this.mView.Woman1_tog.gameObject));
     }
     else
     {
         //this.mView.RoleFullLevel_btn.onClick.RemoveAllListeners();
         //this.mView.AddCopper_btn.onClick.RemoveAllListeners();
         //this.mView.ClearStage_btn.onClick.RemoveAllListeners();
         //this.mView.AddPower_btn.onClick.RemoveAllListeners();
         //this.mView.ElevateVIP_btn.onClick.RemoveAllListeners();
         //this.mView.GeneralFullLevel_btn.onClick.RemoveAllListeners();
         //this.mView.AddGold_btn.onClick.RemoveAllListeners();
         //this.mView.ClearLeve_btn.onClick.RemoveAllListeners();
         //this.mView.AddVigor_btn.onClick.RemoveAllListeners();
         //this.mView.Outfit_btn.onClick.RemoveAllListeners();
         //this.mView.Advance500_btn.onClick.RemoveAllListeners();
         //this.mView.AddHonor_btn.onClick.RemoveAllListeners();
         //this.mView.SkillFullLevel_btn.onClick.RemoveAllListeners();
         //this.mView.Advance3_btn.onClick.RemoveAllListeners();
         //this.mView.Intensify_btn.onClick.RemoveAllListeners();
         //this.mView.AddVigor_btn.onClick.RemoveAllListeners();
         //this.mView.Divination_btn.onClick.RemoveAllListeners();
         //this.mView.Sophistication_btn.onClick.RemoveAllListeners();
         this.mView.Close_btn.onClick.RemoveAllListeners();
         // ZEventSystem.Instance.DeRegister(EventConst.OnMsgOnMain, this);
         // this.mView.Woman_tog.onValueChanged.RemoveAllListeners();
     }
 }
Beispiel #19
0
 public void OnLogin(ServerMsgObj msgObj)
 {
     if (Role.Instance.RoleName == "")
     {
         UIFace.GetSingleton().Close(UIID.Login);
         UIFace.GetSingleton().Open(UIID.CreateRole);
     }
     else
     {
         PlayerPrefs.SetString("username", mView.account_input.text);
         PlayerPrefs.SetString("passwd", mView.password_input.text);
         SceneMgr.Instance.LoadScene("Main");
     }
 }
Beispiel #20
0
    public void OnStubSaveOver()
    {
        CanvasView.Instance.AddNotice(JsonMgr.GetSingleton().GetGlobalStringArrayByID(2003).desc);
        //同步给Role
        var stubData = Role.Instance.GetStubData(_stubType);

        stubData.Clear();
        foreach (var p in mView.StubData)
        {
            stubData.Add(new Vector2Int(p.Key, p.Value));
        }
        ZEventSystem.Dispatch(EventConst.OnStubChange);
        UIFace.GetSingleton().Close(UIID.Stub);
    }
Beispiel #21
0
 public override void Awake()
 {
     base.Awake();
     EventListener.Get(takeoff_btn.gameObject).OnClick = e =>
     {
         if (data == null)
         {
             return;
         }
         EquipMgr.GetSingleton().TakeOffEquip(data);
         data = null;
         UIFace.GetSingleton().Close(UIID.StrengthenTip);
         ZEventSystem.Dispatch(EventConst.REFRESHLEFT);
     };
 }
Beispiel #22
0
 private void initEvent(bool open)
 {
     if (open)
     {
         this.mView.defend_btn.onClick.AddListener(delegate() {
             UIFace.GetSingleton().Open(UIID.Stub, 0, StubType.PVPDefend);
         });
         ZEventSystem.Register(EventConst.OnStubChange, this, "OnStubChange");
     }
     else
     {
         this.mView.defend_btn.onClick.RemoveAllListeners();
         ZEventSystem.DeRegister(EventConst.OnStubChange, this);
     }
 }
 /// <summary>
 /// 招募普通单个
 /// </summary>
 public void ClickOrdinaryBuyOne()
 {
     RecruitingMgr.Instance.type = (int)RecruitingType.OrdinaryOne;
     if (Role.Instance.Cash >= (int)LuckyDrawResoults.OUNITITEM)
     {
         UIFace.GetSingleton().Open(UIID.RecruitingAward);
         ZEventSystem.Dispatch(EventConst.ShowOneLuckyDrawResults, RecruitingMgr.Instance._item, (int)RecruitingType.OrdinaryOne);
         Role.Instance.Cash -= (int)LuckyDrawResoults.OUNITITEM;
         Debug.Log(Role.Instance.Cash);
     }
     else
     {
         CanvasView.Instance.AddNotice("钱不够!");
     }
 }
 /// <summary>
 /// 招募普通十个
 /// </summary>
 public void ClickOrdinaryBuyTen()
 {
     RecruitingMgr.Instance.type = (int)RecruitingType.OrdinaryTen;
     if (Role.Instance.Cash >= int.Parse(ordinarybuytenprice_txt.text))
     {
         UIFace.GetSingleton().Open(UIID.RecruitingAward);
         ZEventSystem.Dispatch(EventConst.ShowTenLuckyDrawResults, RecruitingMgr.Instance.itemList, (int)RecruitingType.OrdinaryTen);
         Role.Instance.Cash -= int.Parse(ordinarybuytenprice_txt.text);
         Debug.Log(Role.Instance.Cash);
     }
     else
     {
         CanvasView.Instance.AddNotice("钱不够!");
     }
 }
Beispiel #25
0
    public void Logout()
    {
        TipCtrl ctrl = (TipCtrl)UIFace.GetSingleton().Open(UIID.Tip, 6);

        UIFace.GetSingleton().Open(UIID.Tip);
        ctrl.SetHandler(
            delegate()
        {
            Logout(false);
        },
            delegate()
        {
            Logout(true);
        }
            );
    }
Beispiel #26
0
    /// <summary>
    /// 是否更改昵称
    /// </summary>
    /// <param name="isalter"></param>
    public void IsRename()
    {
        TipCtrl ctrl = (TipCtrl)UIFace.GetSingleton().Open(UIID.Tip, 5);

        UIFace.GetSingleton().Open(UIID.Tip);
        ctrl.SetHandler(
            delegate()
        {
            Affirm(false);
        },
            delegate()
        {
            Affirm(true);
        }
            );
    }
 public void Open()
 {
     select_trf.gameObject.SetActive(false);
     progress = Role.Instance.DivinationTree;
     SetProgress(progress);
     lucky_img.fillAmount = Role.Instance.DivinationLucky / maxLucky;
     EventListener.Get(take_btn.gameObject).OnClick = e =>
     {
         ZEventSystem.Register(EventConst.ONOPENCOMPOSE, this, "OnOpenCompose");
         UIFace.GetSingleton().Open(UIID.HeroDetail, HeroMgr.GetSingleton().GetNo1(), EHEROSHOWTYPE.Divination);
         Close();
         if (select_trf.gameObject.activeInHierarchy)
         {
             select_trf.gameObject.SetActive(false);
         }
         ZEventSystem.DeRegister(EventConst.ONOPENCOMPOSE);
     };
 }
Beispiel #28
0
 /// <summary>
 /// 场景加载完成,打开初始需要的界面
 /// </summary>
 /// <param name="name"></param>
 public void OnSceneLoaded(string name)
 {
     if (name == "Main")
     {
         ProcessCtrl.Instance.GoCoroutine("PlayBackgroundSound", CoroutinPlayMusic(100002));
         UIFace.GetSingleton().Open(UIID.Main);
     }
     else if (name == "Login")
     {
         ProcessCtrl.Instance.GoCoroutine("PlayBackgroundSound", CoroutinPlayMusic(100001));
         ProcessCtrl.Instance.GoCoroutine("CoroutineOpenLogin", CoroutineOpenLogin());
     }
     else if (name == "Game")
     {
         ProcessCtrl.Instance.GoCoroutine("PlayBackgroundSound", CoroutinPlayMusic(100003));
         UIFace.GetSingleton().Open(UIID.Match);
     }
 }
    private void TriggerListener()
    {
        EventListener.Get(card_img.gameObject).OnClick                       =
            EventListener.Get(officer_img.gameObject).OnClick                =
                EventListener.Get(divination_img.gameObject).OnClick         =
                    EventListener.Get(skill_img.gameObject).OnClick          =
                        EventListener.Get(relation_img.gameObject).OnClick   =
                            EventListener.Get(detail_img.gameObject).OnClick = Listener;


        EventListener.Get(ddBG_img.gameObject).OnClick        =
            EventListener.Get(ddArrow_btn.gameObject).OnClick = ShowPopList;

        EventListener.Get(Add_btn.gameObject).OnClick = e =>
        {
            UIFace.GetSingleton().Open(UIID.ExpPool, heroData.HeroId);
        };
    }
    public void Open(TotemData data, SHOWBUTTON btnCtrl)
    {
        take_btn.gameObject.SetActive(btnCtrl == SHOWBUTTON.Etake);
        takeoff_btn.gameObject.SetActive(btnCtrl == SHOWBUTTON.EtakeOff);

        EventListener.Get(take_btn.gameObject).OnClick = e =>
        {
            ZEventSystem.Dispatch(EventConst.TAKETOTEM, data);
            UIFace.GetSingleton().Close(UIID.DivinationTip);
        };
        EventListener.Get(compose_btn.gameObject).OnClick = e =>
        {
            UIFace.GetSingleton().Open(UIID.CompostDivination, data);
            ZEventSystem.Dispatch(EventConst.ONOPENCOMPOSE);
            UIFace.GetSingleton().Close(UIID.DivinationTip);
        };
        EventListener.Get(takeoff_btn.gameObject).OnClick = e =>
        {
            TotemMgr.GetSingleton().TakeOffTotem(data);
            ZEventSystem.Dispatch(EventConst.REFRESHRIGHT, false);
            UIFace.GetSingleton().Close(UIID.DivinationTip);
        };
        item_img.sprite = ResourceMgr.Instance.LoadSprite(data.ItemData.icon);
        int    rare  = data.ItemData.rare;
        string color = ColorMgr.Colors[rare - 1];

        name_txt.text         = string.Format("<color=#{0}>{1}</color>", color, data.TotemConfig.Name);
        level_txt.text        = string.Format("<color=#{0}>Lv.{1}</color>", color, data.Level);
        slider_img.fillAmount = data.Exp / (float)data.LevelUpExp();
        prog_txt.text         = data.Exp + "/" + data.LevelUpExp();
        Pro[]         p  = data.Attribute;
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < p.Length; ++i)
        {
            sb.Append(AttrUtil.GetAttribute(p[i].attr));
            sb.Append("  +");
            sb.Append(AttrUtil.ShowText(p[i].attr, p[i].num, p[i].per));
            sb.Append("\n");
        }
        attr_txt.text = sb.ToString();
    }