Ejemplo n.º 1
0
    protected override void OnAwakeInitUI()
    {
        mBtnQuit         = CacheTrans.FindComponent <UIButton>("Root/BtnQuit");
        mBtnDissolveRoom = CacheTrans.FindComponent <UIButton>("Root/BtnDissolveRoom");
        mToggleNational  = CacheTrans.FindComponent <UIToggle>("Root/TypeGroup/Option1");
        mToggleLocalism  = CacheTrans.FindComponent <UIToggle>("Root/TypeGroup/Option2");


        UIEventListener.Get(mBtnQuit.gameObject).onClick         += OnQuitClick;
        UIEventListener.Get(mBtnDissolveRoom.gameObject).onClick += OnDissolveRoomClick;

        CacheTrans.GetUIEventListener("Root/BtnClose").onClick += OnCloseClick;

        CacheTrans.GetUIEventListener("Root/MusicGroup/BtnCloseMusic").onClick += OnMusicClick;
        CacheTrans.GetUIEventListener("Root/MusicGroup/BtnOpenMusic").onClick  += OnMusicClick;

        mMusicSlider = CacheTrans.FindComponent <UISlider>("Root/MusicGroup/Slider");
        mMusicSlider.onChange.Add(new EventDelegate(OnMusicChangeClick));

        CacheTrans.GetUIEventListener("Root/SoundGroup/BtnCloseSound").onClick += OnSoundClick;
        CacheTrans.GetUIEventListener("Root/SoundGroup/BtnOpenSound").onClick  += OnSoundClick;
        CacheTrans.GetUIEventListener("Root/TypeGroup/Option1").onClick        += OnAudioToggleValueChange;
        CacheTrans.GetUIEventListener("Root/TypeGroup/Option2").onClick        += OnAudioToggleValueChange;

        mSoundSlider = CacheTrans.FindComponent <UISlider>("Root/SoundGroup/Slider");
        mSoundSlider.onChange.Add(new EventDelegate(OnSoundChangeClick));
    }
Ejemplo n.º 2
0
    private void ReplaceCardsSkin()
    {
        if (mCardsAtlas == null)
        {
            mCardsAtlas = Resources.Load <GameObject>("CardPrefab/8_UICardsAtlasNew").GetComponent <UIAtlas>();
        }

        UISprite[] cards = CacheTrans.GetComponentsInChildren <UISprite>(true);
        foreach (UISprite sprite in cards)
        {
            if (sprite.atlas.name == "8_UICardsAtlas")
            {
                /*
                 * Vector2 tempSize = sprite.localSize;
                 * string tempSpriteName = sprite.spriteName;
                 * GameObject spriteObject = sprite.gameObject;
                 * GameObject.Destroy(sprite);
                 *
                 * UISprite newSprite = spriteObject.AddComponent<UISprite>();
                 * newSprite.atlas = mCardsAtlas;
                 * newSprite.spriteName = tempSpriteName;
                 * newSprite.SetRect(0, 0, tempSize.x, tempSize.y);
                 * Debug.Log(tempSize.x.ToString() + "  " + tempSize.y.ToString());
                 */
                sprite.atlas = mCardsAtlas;
            }
        }
    }
Ejemplo n.º 3
0
    protected override void OnAwakeInitUI()
    {
        GameMgr.Instance.isFromRecord = false;
        if (mUIMainModel == null)
        {
            mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
            mUIMainModel.ValueUpdateEvent += OnValueUpdateEvent;
        }
        mHeadIcon     = CacheTrans.FindComponent <UITexture>("Root/ContainerTop/ContainerLeft/HeadGroup/HeadIcon");
        mNameLabel    = CacheTrans.FindComponent <UILabel>("Root/ContainerTop/ContainerLeft/HeadGroup/Name");
        mUserIdLabel  = CacheTrans.FindComponent <UILabel>("Root/ContainerTop/ContainerLeft/HeadGroup/ID");
        mDiamondLabel = CacheTrans.FindComponent <UILabel>("Root/ContainerTop/ContainerLeft/DiamondsGroup/LabelDiamond");

        CacheTrans.GetUIEventListener("Root/ContainerTop/ContainerLeft/DiamondsGroup/BtnAdd").onClick += OnDiamondClick;
        CacheTrans.GetUIEventListener("Root/ContainerTop/ContainerLeft/HeadGroup/HeadIcon").onClick   += OnUserClick;

        CacheTrans.GetUIEventListener("Root/ContainerTop/ContainerRight/BtnSetting").onClick  += OnSettingClick;
        CacheTrans.GetUIEventListener("Root/ContainerTop/ContainerRight/BtnPlay").onClick     += OnPlayClick;
        CacheTrans.GetUIEventListener("Root/ContainerTop/ContainerRight/BtnNews").onClick     += OnNewsClick;
        CacheTrans.GetUIEventListener("Root/ContainerTop/ContainerRight/BtnTutorial").onClick += OnTutorialClick;

        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnReward").onClick   += OnRewardClick;
        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnPlayback").onClick += OnPlaybackClick;
        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnShare").onClick    += OnShareClick;
        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnActivity").onClick += OnActivityClick;
        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnShop").onClick     += OnShopClick;

        Net.Instance.Send(1303, null, null);
    }
Ejemplo n.º 4
0
 protected override void OnAwakeInitUI()
 {
     mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
     CacheTrans.GetUIEventListener("Root/BtnClose").onClick  += OnReturnClick;
     CacheTrans.GetUIEventListener("Root/BtnFriend").onClick += OnFriendClick;
     CacheTrans.GetUIEventListener("Root/BtnCircle").onClick += OnCircleClick;
     ApplicationMgr.Instance.ShareSDK.shareHandler            = OnShareResultHandler;
 }
Ejemplo n.º 5
0
    protected override void OnAwakeInitUI()
    {
        mConfirmButton = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/ConfirmButton");
        mCanelButton   = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/CanelButton");
        UIEventListener.Get(mConfirmButton.gameObject).onClick += OnConfirmClick;
        UIEventListener.Get(mCanelButton.gameObject).onClick   += OnCanelClick;

        mDesLabel    = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/DialogGroup/ButtonGroup/DesLabel");
        mPlayerLabel = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/DialogGroup/ButtonGroup/PlayerLabel");
    }
Ejemplo n.º 6
0
 protected override void OnAwakeInitUI()
 {
     mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
     CacheTrans.GetUIEventListener("Root/BtnClose").onClick += OnCloseClick;
     ExpressionItem[] expressionItems = CacheTrans.GetComponentsInChildren <ExpressionItem>();
     foreach (var item in expressionItems)
     {
         item.OnCloseClick += OnCloseClick;
     }
 }
Ejemplo n.º 7
0
    protected override void OnAwakeInitUI()
    {
        mPlayerCountGroup = CacheTrans.FindComponent <CToggleGroup>("Root/ContainerCenter/ContainerLeft/BtnOption1/Scroll View/OptionGroups/PlayerCountGroup");
        mSeqCountGroup    = CacheTrans.FindComponent <CToggleGroup>("Root/ContainerCenter/ContainerLeft/BtnOption1/Scroll View/OptionGroups/SeqCountGroup");
        mEndPointsGroup   = CacheTrans.FindComponent <CToggleGroup>("Root/ContainerCenter/ContainerLeft/BtnOption1/Scroll View/OptionGroups/EndPointsGroup");
        mPlayOptionGroup  = CacheTrans.FindComponent <CToggleGroup>("Root/ContainerCenter/ContainerLeft/BtnOption1/Scroll View/OptionGroups/PlayOptionGroup");

        CacheTrans.GetUIEventListener("Root/ContainerTop/BtnClose").onClick         += OnReturnClick;
        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnCreateRoom").onClick += OnCreateRoomClick;
    }
Ejemplo n.º 8
0
 protected override void OnAwakeInitUI()
 {
     if (mUIMainModel == null)
     {
         mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
         mUIMainModel.ValueUpdateEvent += OnValueUpdateEvent;
     }
     mDiamondLabel  = CacheTrans.FindComponent <UILabel>("Root/ContainerBottom/DiamondGroup/Label");
     mIntegralLabel = CacheTrans.FindComponent <UILabel>("Root/ContainerBottom/IntegralGroup/Label");
     CacheTrans.GetUIEventListener("Root/ContainerTop/BtnReturn").onClick += OnReturnClick;
 }
Ejemplo n.º 9
0
    protected override void OnAwakeInitUI()
    {
        mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();

        mChatInput = CacheTrans.FindComponent <UIInput>("Root/ContainerBottom/ChatInput");
        CacheTrans.GetUIEventListener("Root/BtnClose").onClick += OnCloseClick;
        CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnSend").onClick += OnSendInfoClick;

        mSimpleChatItems = CacheTrans.FindChindComponents <UIButton>("Root/ContainerCenter");
        Array.ForEach <UIButton>(mSimpleChatItems, p => { UIEventListener.Get(p.gameObject).onClick += OnSendCommonInfoClick; });
    }
Ejemplo n.º 10
0
 protected override void OnAwakeInitUI()
 {
     if (mUIMainModel == null)
     {
         mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
         mUIMainModel.ValueUpdateEvent += OnValueUpdateEvent;
     }
     mUIWrapContent = CacheTrans.FindComponent <UIWrapContent>("Root/MessageGroup/ScrollView/Grid");
     mScrollGrid    = CacheTrans.FindComponent <ScrollGrid>("Root/MessageGroup/ScrollView/Grid");
     CacheTrans.GetUIEventListener("Root/TitleGroup/BtnReturn").onClick += OnReturnClick;
     mUIWrapContent.onInitializeItem = onInitializeItem;
 }
Ejemplo n.º 11
0
    protected override void OnAwakeInitUI()
    {
        mTitleLabel    = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/DialogGroup/Title");
        mDesLabel      = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/DialogGroup/ButtonGroup/DesLabel");
        mConfirmButton = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/ConfirmButton");
        mCanelButton   = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/CanelButton");
        mOkButton      = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/OkButton");

        mHUDText      = CacheTrans.FindComponent <HUDText>("HUDText");
        mRoot         = CacheTrans.FindComponent <Transform>("Root");
        mMaskCollider = CacheTrans.FindComponent <Transform>("MaskCollider");
    }
Ejemplo n.º 12
0
    protected override void OnAwakeInitUI()
    {
        if (mUIMainModel == null)
        {
            mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
        }
        mNoReferralCodeState  = CacheTrans.FindComponent <Transform>("Root/ContainerCenter");
        mHasReferralCodeState = CacheTrans.FindComponent <Transform>("Root/Label");
        mInputReferralCode    = CacheTrans.FindComponent <UIInput>("Root/ContainerCenter/InputReferralCode");

        CacheTrans.GetUIEventListener("Root/TitleGroup/BtnClose").onClick        += OnReturnClick;
        CacheTrans.GetUIEventListener("Root/ContainerCenter/BtnConfirm").onClick += OnBindingClick;
    }
Ejemplo n.º 13
0
 protected override void OnAwakeInitUI()
 {
     if (mUIMainModel == null)
     {
         mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
     }
     mHeadIcon      = CacheTrans.FindComponent <UITexture>("Root/UserGroup/HeadIcon");
     mSexIcon       = CacheTrans.FindComponent <UISprite>("Root/UserGroup/HeadIcon/SexIcon");
     mNameLabel     = CacheTrans.FindComponent <UILabel>("Root/UserGroup/Name");
     mUserIdLabel   = CacheTrans.FindComponent <UILabel>("Root/UserGroup/ID");
     mDiamondLabel  = CacheTrans.FindComponent <UILabel>("Root/UserGroup/Diamond");
     mIntegralLabel = CacheTrans.FindComponent <UILabel>("Root/UserGroup/Integral");
     CacheTrans.GetUIEventListener("Root/TitleGroup/BtnReturn").onClick          += OnReturnClick;
     CacheTrans.GetUIEventListener("Root/UserGroup/Diamond/BtnRecharge").onClick += OnRechargeClick;
     mIntegralLabel.gameObject.SetVisible(false);
 }
Ejemplo n.º 14
0
 protected override void OnAwakeInitUI()
 {
     mUIGameModel = UIModelMgr.Instance.GetModel <UIGameModel>();
     CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnReturn").onClick += OnSingleGameEndClick;
     mSingleEndItems = CacheTrans.FindChindComponents <SingleSettlementItem>("Root/ContainerCenter");
     mCurrCardItem   = CacheTrans.FindComponent <CardItem>("Root/ContainerTop/CurrCardItem");
     mHandCardItem   = CacheTrans.FindComponent <HandCardGroupItem>("Root/ContainerTop/HandCards");
     if (mHandCradGroupItems == null)
     {
         mHandCradGroupItems = new List <HandCardGroupItem>();
     }
     mHandCradGroupItems.Add(CacheTrans.FindComponent <HandCardGroupItem>("Root/ContainerTop/HandCardGroup/CardGroup0"));
     mHandCradGroupItems.Add(CacheTrans.FindComponent <HandCardGroupItem>("Root/ContainerTop/HandCardGroup/CardGroup1"));
     mHandCradGroupItems.Add(CacheTrans.FindComponent <HandCardGroupItem>("Root/ContainerTop/HandCardGroup/CardGroup2"));
     mHandCradGroupItems.Add(CacheTrans.FindComponent <HandCardGroupItem>("Root/ContainerTop/HandCardGroup/CardGroup3"));
     mGameResult = CacheTrans.FindComponent <UISprite>("Root/ContainerTop/GameResult");
     mLabelHuDes = CacheTrans.FindComponent <UILabel>("Root/ContainerTop/LabelHuDes");
 }
Ejemplo n.º 15
0
    protected override void OnAwakeInitUI()
    {
        mLabelNum = CacheTrans.FindComponent <UILabel>("Root/NumGroup/LabelNum");
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey0").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey1").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey2").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey3").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey4").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey5").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey6").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey7").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey8").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnKey9").onClick    += KeyClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnDelete").onClick  += DeleteClick;
        CacheTrans.GetUIEventListener <UIButton>("Root/KeyGroup/BtnReInput").onClick += ReInputClick;

        CacheTrans.GetUIEventListener <UIButton>("Root/NumGroup/BG/BtnClose").onClick += OnReturnClick;
    }
Ejemplo n.º 16
0
 protected override void OnAwakeInitUI()
 {
     if (mUIMainModel == null)
     {
         mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
     }
     mUIInput             = CacheTrans.FindComponent <UIInput>("Root/ContainerBottom/Input");
     mLabel               = CacheTrans.FindComponent <UILabel>("Root/ContainerBottom/LoginGroup/CheckAgreement/Label");
     mAppVersion          = CacheTrans.FindComponent <UILabel>("Root/ContainerBottom/AppVersion");
     mSwitchAccount       = CacheTrans.FindComponent <UIToggle>("Root/ContainerBottom/LoginGroup/SwitchAccount");
     mCheckAgreement      = CacheTrans.FindComponent <UIToggle>("Root/ContainerBottom/LoginGroup/CheckAgreement");
     mLoginGroup          = CacheTrans.FindComponent <Transform>("Root/ContainerBottom/LoginGroup");
     mAgreementGroup      = CacheTrans.FindComponent <Transform>("Root/ContainerCenter/AgreementGroup");
     mOperationEffectItem = CacheTrans.FindComponent <OperationEffectItem>("Root/Sprite");
     CacheTrans.GetUIEventListener <UIButton>("Root/ContainerBottom/LoginGroup/BtnLogin").onClick       += LoginClick;
     CacheTrans.GetUIEventListener <UIButton>("Root/ContainerCenter/AgreementGroup/BtnCanel").onClick   += AgreementButtonClick;
     CacheTrans.GetUIEventListener <UIButton>("Root/ContainerCenter/AgreementGroup/BtnConfirm").onClick += AgreementButtonClick;
     ApplicationMgr.Instance.ShareSDK.authHandler     += OnAuthResultHandler;
     ApplicationMgr.Instance.ShareSDK.showUserHandler += OnGetUserInfoResultHandler;
 }
Ejemplo n.º 17
0
    protected override void OnAwakeInitUI()
    {
        if (mUIVersiionModel == null)
        {
            mUIVersiionModel = UIModelMgr.Instance.GetModel <UIVersionModel>();
        }
        mUIVersiionModel.ValueUpdateEvent += OnValueUpdateEvent;

        mTitleLabel    = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/Body/TitleBg/Title");
        mDesLabel      = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/Body/DesLabel");
        mConfirmButton = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/Body/ButtonGroup/ConfirmButton");
        mCanelButton   = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/Body/ButtonGroup/CanelButton");
        mOkButton      = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/Body/ButtonGroup/OkButton");

        UIEventListener.Get(mConfirmButton.gameObject).onClick += OnCloseClick;
        UIEventListener.Get(mCanelButton.gameObject).onClick   += OnCloseClick;
        UIEventListener.Get(mOkButton.gameObject).onClick      += OnCloseClick;
        ApplicationMgr.Instance.onUpdate += onUpdate;
        mDesLabel.text = "检查更新中...";
    }
Ejemplo n.º 18
0
    protected override void OnAwakeInitUI()
    {
        mHeadIcon     = CacheTrans.FindComponent <UITexture>("Root/HeadIcon");
        mSexIcon      = CacheTrans.FindComponent <UISprite>("Root/HeadIcon/SexIcon");
        mLabelName    = CacheTrans.FindComponent <UILabel>("Root/LabelName");
        mLabelId      = CacheTrans.FindComponent <UILabel>("Root/LabelId");
        mLabelIp      = CacheTrans.FindComponent <UILabel>("Root/LabelIp");
        mLabelAddress = CacheTrans.FindComponent <UILabel>("Root/LabelAddress");
        CacheTrans.GetUIEventListener("MaskCollider").onClick += OnClosedClick;

        mPropObject = CacheTrans.Find("RootRight").gameObject;

        GPS._instence.OnLocate += OnLocate;
        GPS._instence.OnError  += OnError;

        if (mUIMainModel == null)
        {
            mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
        }
    }
Ejemplo n.º 19
0
    protected override void OnAwakeInitUI()
    {
        if (mUIMainModel == null)
        {
            mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
            mUIMainModel.ValueUpdateEvent += OnValueUpdateEvent;
        }
        mBtnReturnRoom = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/BtnReturnRoom");
        mBtnCreateRoom = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/BtnCreateRoom");
        UIEventListener.Get(mBtnReturnRoom.gameObject).onClick += ReturnRoomClick;
        UIEventListener.Get(mBtnCreateRoom.gameObject).onClick += CreateRoomClick;

        CacheTrans.GetUIEventListener("Root/ContainerCenter/BtnJoinRoom").onClick += JoinRoomClick;

        mNoticeMsg = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/Notice/ScrollView/NoticeInfo");
        mTweener   = mNoticeMsg.transform.DOLocalMoveX(-1200, 15f);
        mTweener.SetAutoKill(false)
        .SetDelay(2f)
        .OnComplete(() => mTweener.Restart())
        .Pause();
    }
Ejemplo n.º 20
0
    protected override void onUpdate()
    {
        //当前目标不存在
        bool isHave = EntityMgr.isHaveEntity(data.goalUID);

        if (!isHave)
        {
            onFinish();
            return;
        }
        CEntity goal = EntityMgr.getEntity(data.goalUID);

        disVec = goal.CacheTrans.position + Vector3.up - CacheTrans.position;
        dir    = disVec.normalized;
        CacheTrans.LookAt(goal.CacheTrans.position + Vector3.up);
        Debug.DrawRay(CacheTrans.position, dir, Color.red, 0.5f);
        if (Physics.Raycast(CacheTrans.position, dir, out info, speed))
        {
            //碰撞到目标
            CEntity hitEntity = info.collider.GetComponent <CEntity>();
            if (hitEntity != null)
            {
                if (hitEntity.UID == goal.UID)
                {
                    CacheTrans.position = goal.CacheTrans.position;
                    if (data.callBack != null)
                    {
                        data.callBack.Invoke(data.cfgId, data.goalUID, CacheTrans.position);
                    }
                    onFinish();
                }
            }
        }
        else
        {
            CacheTrans.position += dir * speed;
        }
    }
Ejemplo n.º 21
0
 protected override void OnAwakeInitUI()
 {
     CacheTrans.GetUIEventListener("Root/TitleGroup/BtnReturn").onClick += OnReturnClick;
 }
Ejemplo n.º 22
0
 protected override void OnAwakeInitUI()
 {
     CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnShare").onClick += OnShareClick;
     mWholeEndItems = CacheTrans.FindChindComponents <GameSettlementItem>("Root/ContainerCenter");
     CacheTrans.GetUIEventListener("Root/ContainerBottom/BtnReturn").onClick += OnWholeGameEndClick;
 }
Ejemplo n.º 23
0
    protected override void onUpdate()
    {
        //当前目标不存在
        bool isHave = EntityMgr.isHaveEntity(data.goalUID);

        if (!isHave)
        {
            onFinish();
            return;
        }
        //当前目标存在 每帧计算距离

        /*
         * CEntity goal = EntityMgr.getEntity(data.goalUID);
         * disVec = goal.CacheTrans.position - CacheTrans.position;
         * dir = disVec.normalized;
         * dis = disVec.magnitude;
         * CacheTrans.LookAt(goal.CacheTrans);
         * Debug.DrawRay(CacheTrans.position, dir, Color.red, 0.5f);
         * if (dis <= reachDis)
         * {
         *    if (data.callBack != null)
         *    {
         *        data.callBack.Invoke(data.cfgId, data.goalUID, CacheTrans.position);
         *    }
         *    onFinish();
         * }
         * CacheTrans.position += dir* speed;
         */

        //每帧射线检测 有效率问题吗?

        /*
         * CEntity goal = EntityMgr.getEntity(data.goalUID);
         * disVec = goal.CacheTrans.position+Vector3.up - CacheTrans.position;
         * dir = disVec.normalized;
         * CacheTrans.LookAt(goal.CacheTrans.position + Vector3.up);
         * Debug.DrawRay(CacheTrans.position, dir, Color.red, 0.5f);
         * if (Physics.Raycast(CacheTrans.position, dir, out info,speed))
         * {
         *  //碰撞到目标
         *  CEntity hitEntity = info.collider.GetComponent<CEntity>();
         *  if (hitEntity != null) {
         *      if (hitEntity.UID == goal.UID)
         *      {
         *          CacheTrans.position = goal.CacheTrans.position;
         *          if (data.callBack != null)
         *          {
         *              data.callBack.Invoke(data.cfgId, data.goalUID, CacheTrans.position);
         *          }
         *          onFinish();
         *      }
         *      else {
         *          onFinish();
         *      }
         *  }
         * }
         * else {
         *  CacheTrans.position += dir * speed;
         * }
         */
        CEntity goal = EntityMgr.getEntity(data.goalUID);

        disVec = goal.CacheTrans.position + Vector3.up - CacheTrans.position + Vector3.up;
        dir    = disVec.normalized;
        CacheTrans.LookAt(goal.CacheTrans.position + Vector3.up);
        Debug.DrawRay(CacheTrans.position, dir, Color.red, 0.5f);
        if (Physics.Raycast(CacheTrans.position, dir, out info, speed))
        {
            //碰撞到目标
            CEntity hitEntity = info.collider.GetComponent <CEntity>();
            if (hitEntity != null)
            {
                if (hitEntity.UID == goal.UID)
                {
                    CacheTrans.position = goal.CacheTrans.position;
                    if (data.callBack != null)
                    {
                        data.callBack.Invoke(data.cfgId, data.goalUID, CacheTrans.position);
                    }
                    onFinish();
                }
                else
                {
                    onFinish();
                }
            }
        }
        else
        {
            CacheTrans.position += dir * speed;
        }
    }
Ejemplo n.º 24
0
    protected override void OnAwakeInitUI()
    {
        _instance = this;

        if (mUIGameModel == null)
        {
            mUIGameModel = UIModelMgr.Instance.GetModel <UIGameModel>();
            mUIGameModel.ValueUpdateEvent += OnValueUpdateEvent;
        }

        if (mUIMainModel == null)
        {
            mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>();
        }
        mPublicGroupMgr = CacheTrans.FindComponent <PublicGroupMgr>("Root/PublicGroup");
        mLabelSeqCount  = CacheTrans.FindComponent <UILabel>("Root/PublicGroup/RunGroup/LabelSeqCount");
        mLabelCardNum   = CacheTrans.FindComponent <UILabel>("Root/PublicGroup/RunGroup/LabelCardNum");
        mGameTableItem  = CacheTrans.FindComponent <GameTableItem>("Root/PublicGroup/RunGroup/GameTable");

        mRecordControl = CacheTrans.FindComponent <RecordControl>("Root/PublicGroup/RunGroup/RecordControl");

        mJingCardItems = CacheTrans.FindChindComponents <CardItem>("Root/PublicGroup/RunGroup/ContainerTop/JingCards");
        mOpenCardItems = CacheTrans.FindChindComponents <CardItem>("Root/PublicGroup/RunGroup/OpenCardItems");

        if (mPlayerItems == null)
        {
            mPlayerItems = new List <PlayerInfoItem>();
        }

        mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerBottom/PlayerInfo"));
        mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerRight/PlayerInfo"));
        mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerTop/PlayerInfo"));
        mPlayerItems.Add(CacheTrans.FindComponent <PlayerInfoItem>("Root/ContainerLeft/PlayerInfo"));

        if (mPlayerCardGroupList == null)
        {
            mPlayerCardGroupList = new List <PlayerCardGroupItem>();
        }
        mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerBottom/PlayerCardGroup"));
        mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerRight/PlayerCardGroup"));
        mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerTop/PlayerCardGroup"));
        mPlayerCardGroupList.Add(CacheTrans.FindComponent <PlayerCardGroupItem>("Root/ContainerLeft/PlayerCardGroup"));
        mVoiceAnimation = CacheTrans.FindComponent <UISpriteAnimation>("Root/PublicGroup/VoiceAnimation");

        #region 注册按钮的点击方法

        mBtnDissolveRoom = CacheTrans.FindComponent <UIButton>("Root/PublicGroup/PrepareGroup/ContainerRight/BtnDissolveRoom");
        mBtnLeaveRoom    = CacheTrans.FindComponent <UIButton>("Root/PublicGroup/PrepareGroup/ContainerRight/BtnLeaveRoom");
        UIEventListener.Get(mBtnDissolveRoom.gameObject).onClick += OnDissolveRoomClick;
        UIEventListener.Get(mBtnLeaveRoom.gameObject).onClick    += OnDissolveRoomClick;
        CacheTrans.GetUIEventListener("Root/PublicGroup/PrepareGroup/ContainerRight/BtnReturnHall").onClick += OnReturnHallClick;
        CacheTrans.GetUIEventListener("Root/PublicGroup/PrepareGroup/BtnWeChat").onClick                += OnWeChatClick;
        CacheTrans.GetUIEventListener("Root/PublicGroup/RunGroup/ContainerRight/BtnSetting").onClick    += OnSettingClick;
        CacheTrans.GetUIEventListener("Root/PublicGroup/RunGroup/ContainerRight/BtnTextChat").onClick   += OnChatClick;
        CacheTrans.GetUIEventListener("Root/PublicGroup/RunGroup/ContainerRight/BtnExpression").onClick += OnExpressionClick;
        CacheTrans.GetUIEventListener("Root/PublicGroup/ContainerRight/BtnVoiceChat").onPress           += OnRecording;

        #endregion 注册按钮的点击方法

        SetVoiceAnimation(false);
    }
Ejemplo n.º 25
0
 protected override void OnAwakeInitUI()
 {
     mDes = CacheTrans.FindComponent <UILabel>("Root/Des");
     CacheTrans.GetUIEventListener("Root/BtnConfirm").onClick += OnReturnClick;
 }
Ejemplo n.º 26
0
 protected override void OnAwakeInitUI()
 {
     mLabelDes = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/Des");
     CacheTrans.GetUIEventListener("Root/TitleGroup/BtnClose").onClick += OnReturnClick;
 }
Ejemplo n.º 27
0
 protected override void OnAwakeInitUI()
 {
     CacheTrans.GetUIEventListener <UIButton>("Root/ScrollView/Grid/Item4/BtnStartGame").onClick += OnReturnClick;
 }