Exemplo n.º 1
0
    void SetRideBtnState()
    {
        bool show = DataManager.Manager <GuideManager>().IsNewFuncOpenComplete(4);

        MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNBTNHORSE);

        if (btn != null)
        {
            btn.gameObject.SetActive(show);
        }
    }
Exemplo n.º 2
0
 void SetPetRoleBtn(MainBtn petRole)
 {
     if (petRole != null)
     {
         m_petInfo = petRole.GetComponent <PetQuickInfo>();
         if (m_petInfo == null)
         {
             m_petInfo = petRole.gameObject.AddComponent <PetQuickInfo>();
         }
     }
     ShowPetQuickInfo(m_bShowPetQuick);
 }
Exemplo n.º 3
0
    void ShowPetQuickInfo(bool bShow)
    {
        MainBtn petRole = GetMainBtnByType(MainBtnDef.BtnType.BTNPETROLE);

        if (petRole != null)
        {
            petRole.gameObject.SetActive(bShow);
        }
        if (!bShow)
        {
            m_petInfo.Release();
        }
    }
Exemplo n.º 4
0
    void SetGmBtn()
    {
        MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNGM);

        if (btn != null)
        {
            if (Application.isEditor)
            {
                btn.gameObject.SetActive(true);
            }
            else
            {
                btn.gameObject.SetActive(false);
            }
        }
    }
Exemplo n.º 5
0
 void OnSetBtnStatus(int nEventId, object param)
 {
     if (nEventId == (int)GameEventID.MAINBUTTON_STATUSCHANGE)
     {
         stMainButtonStatus status = (stMainButtonStatus)param;
         MainBtn            btn    = GetMainBtnByType((MainBtnDef.BtnType)status.btnID);
         if (btn != null)
         {
             if (status.status == 1)
             {
                 btn.gameObject.SetActive(true);
             }
             else
             {
                 btn.gameObject.SetActive(false);
             }
         }
     }
     else if (nEventId == (int)GameEventID.MAINBUTTON_REDTIPS)
     {
         stMainButtonRedTips tipsdata = (stMainButtonRedTips)param;
         MainBtn             btn      = GetMainBtnByType((MainBtnDef.BtnType)tipsdata.btnID);
         if (btn != null)
         {
             btn.SetRedTipVisble(tipsdata.status == 1);
         }
     }
     if (nEventId == (int)Client.GameEventID.UIEVENTNEWFUNCOPEN)
     {
         uint funcId = (uint)param;
         if (funcId == 4)
         {
             MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNBTNHORSE);
             if (btn != null)
             {
                 btn.gameObject.SetActive(true);
             }
         }
     }
 }
Exemplo n.º 6
0
    void OnAddBtnEvent(int eventId, object param)
    {
        if (eventId == (int)GameEventID.MAINBUTTON_ADD)
        {
            if (param is MainBtn)
            {
                MainBtn btn = param as MainBtn;
                if (!m_lstBtns.Contains(btn))
                {
                    MainBtnDef.BtnType btnType = (MainBtnDef.BtnType)System.Enum.Parse(typeof(MainBtnDef.BtnType), "BTN" + btn.gameObject.name.ToUpper());
                    btn.OnClick = OnMainBtnClick;
                    btn.Index   = (int)btnType;
                    m_lstBtns.Add(btn);

                    if (btnType == MainBtnDef.BtnType.BTNBTNHORSE)
                    {
                        SetRideBtnState();
                    }
                    else if (btnType == MainBtnDef.BtnType.BTNPETROLE)
                    {
                        SetPetRoleBtn(btn);
                    }
                    //Engine.Utility.Log.LogGroup("ZCX", "add btn {0}", btn.m_btnType);
                }
            }
        }
        else if (eventId == (int)Client.GameEventID.JOYSTICK_UNPRESS)
        {
            MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNBTNHORSE);
            if (btn != null)
            {
                btn.gameObject.SetActive(true);
            }
        }
        else if (eventId == (int)Client.GameEventID.JOYSTICK_PRESS)
        {
            MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNBTNHORSE);
            if (btn != null)
            {
                btn.gameObject.SetActive(false);
            }

            ShowTipsUIByState(TipsUIState.None);
        }
        else if (eventId == (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE)
        {
            stEntityUnRide ride = (stEntityUnRide)param;
            if (ride.uid == ClientGlobal.Instance().MainPlayer.GetUID())
            {
                MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNBTNHORSE);
                if (btn != null)
                {
                    // btn.GetComponentInChildren<UILabel>().text = "骑乘";
                }
            }
        }
        else if (eventId == (int)Client.GameEventID.ENTITYSYSTEM_RIDE)
        {
            stEntityRide ride = (stEntityRide)param;
            if (ride.uid == ClientGlobal.Instance().MainPlayer.GetUID())
            {
                MainBtn btn = GetMainBtnByType(MainBtnDef.BtnType.BTNBTNHORSE);
                if (btn != null)
                {
                    //  btn.GetComponentInChildren<UILabel>().text = "下马";
                }
            }
        }
        SetGmBtn();
    }