예제 #1
0
    public void Init()
    {
        byte indx = SceneRuntime.LauncherPrefabIndx(m_Seat, m_bMyself);

        m_ObjectHandle = GameObject.Instantiate(SceneRuntime.PlayerMgr.LauncherObject(indx)) as GameObject;
        m_ObjectHandle.SetActive(true);
        m_ObjectHandle.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);
        m_TransformHandle = m_ObjectHandle.transform;

        m_LabelScore    = m_TransformHandle.GetChild(0).gameObject.GetComponent <UILabel>();
        m_GlodTransform = m_TransformHandle.GetChild(0).GetChild(0);
        m_UIGoldBg      = m_GlodTransform.GetComponent <UISprite>();

        if (m_bMyself)
        {
            for (byte i = 0; i < 2; ++i)
            {
                m_ObjectBtn[i] = m_TransformHandle.GetChild(i + 2).gameObject;
                UIEventListener.Get(m_ObjectBtn[i]).onPress = OnButtonPressMsg;
                switch (i)
                {
                case 0:         //加炮台
                    UIEventListener.Get(m_ObjectBtn[i]).onClick = OnAddButtonMessage;
                    break;

                case 1:         //减炮台
                    UIEventListener.Get(m_ObjectBtn[i]).onClick = OnSubtractButtonMessage;
                    break;
                }
            }
            m_LabelDiamond = m_TransformHandle.GetChild(1).gameObject.GetComponent <UILabel>();
            m_EnergyPoolUI = m_TransformHandle.GetChild(4).gameObject.GetComponent <UISprite>();
            m_LockUI       = m_TransformHandle.GetChild(5).gameObject;
            // SceneRuntime.LauncherEftMgr.PlayDiamondEft(m_TransformHandle.GetChild(1).GetChild(0));
            //  UpdateUserGold(m_Seat);
            m_VipFunctionObj = m_TransformHandle.GetChild(6).gameObject;
            UIEventListener.Get(m_TransformHandle.GetChild(8).gameObject).onClick = OnClickLaunch;
            UIEventListener.Get(m_TransformHandle.GetChild(8).gameObject).onPress = OnButtonPressMsg;
            m_VipFunctionScaleAnim = m_VipFunctionObj.GetComponent <TweenScale>();
            for (byte k = 0; k < 2; ++k)
            {
                UIEventListener.Get(m_TransformHandle.GetChild(6).GetChild(k + 1).gameObject).onPress = OnButtonPressMsg;
                if (k == 0)
                {
                    UIEventListener.Get(m_TransformHandle.GetChild(6).GetChild(k + 1).gameObject).onClick = OnClickChnageLaunch;
                }
                else
                {
                    UIEventListener.Get(m_TransformHandle.GetChild(6).GetChild(k + 1).gameObject).onClick = OnClickAutoLaunch;
                }
            }
            m_BankruptcyObj  = m_TransformHandle.GetChild(7).gameObject;
            m_AutoShotCancel = m_TransformHandle.GetChild(9).gameObject;
            UIEventListener.Get(m_AutoShotCancel).onClick = OnClickAutoShotCancel;
            UIEventListener.Get(m_AutoShotCancel).onPress = OnButtonPressMsg;
        }
        else
        {
            m_FaceTexture = m_TransformHandle.GetChild(1).GetChild(0).GetComponent <UITexture>();
            UIEventListener.Get(m_TransformHandle.GetChild(1).gameObject).onClick = OnClickAvatarMsg;
            UIEventListener.Get(m_TransformHandle.GetChild(1).gameObject).onPress = OnButtonPressMsg;
            m_LockUI              = m_TransformHandle.GetChild(2).gameObject;
            m_BankruptcyObj       = m_TransformHandle.GetChild(5).gameObject;
            m_IsLotteryTips       = m_TransformHandle.GetChild(6).gameObject;
            m_LockedFishEft.m_Obj = m_TransformHandle.GetChild(7).gameObject;
            m_VipLevelIcon        = m_TransformHandle.GetChild(8).GetComponent <UISprite>();
            //  UpdateUserGold(m_Seat);
        }

        CreatGunBarrel(LauncherType);
        //SceneRuntime.LauncherEftMgr.PlayGlodLightEft(m_GlodTransform);
        //是否显示锁
        if (m_RateValid && m_LaunchValid)
        {
            m_LockUI.SetActive(false);
        }

        UpdateRootPos();

        if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() != 0)
        {
            SetMatchGoldBg();
        }
    }