示例#1
0
        /// <summary>
        /// 重登之后需要重置
        /// </summary>
        public void Reset()
        {
            if (mDisplayTips.Count > 0)
            {
                foreach (var item in mDisplayTips)
                {
                    item.mLabel.text = string.Empty;
                }
            }
            else
            {
                mIsLoad = false;
                MainGame.HeartBehavior.StartCoroutine(InitLoad());
                mIsInit = true;
            }

            mCacheText.Clear();
            foreach (var item in mDisplayingTips)
            {
                item.gameObject.SetActive(false);
                item.transform.parent.gameObject.SetActive(false);
            }
            mDisplayingTips.Clear();
            mDisplayingTipTransforms.Clear();

            if (mTimer != null)
            {
                mTimer.Destroy();
                mTimer = null;
            }
            mTimer = new Utils.Timer((int)(GameConstHelper.GetFloat("GAME_FLOAT_TIPS_INTERVAL") * 1000f), true, Mathf.Infinity, UpdateTimer);

            ClientEventMgr.Instance.SubscribeClientEvent((int)ClientEvent.CE_SWITCHINSTANCE, OnSwitchInstance);
            ClientEventMgr.Instance.SubscribeClientEvent((int)ClientEvent.CE_SHOW_ROLLING_NOTICE_END, OnShowRollingNoticeEnd);
        }
示例#2
0
        /// <summary>
        /// 暂停自动战斗
        /// </summary>
        public void PauseAutoFighting(bool isShowTips = false)
        {
            if (InstanceHelper.InstanceIsInPlay() == false)
            {
                return;
            }

            Actor localPlayer = Game.GetInstance().GetLocalPlayer();

            if (localPlayer == null)
            {
                return;
            }

            if (IsAutoFighting && localPlayer.GetAIEnable() == true)
            {
                localPlayer.ActiveAI(false);
                localPlayer.AttackCtrl.ClearCacheSkill();
                GameInput.Instance.EnableInput(true);
                mAutoFightBreakingTime = 0.0f;
                mAutoBreakRecoverTime  = GameConstHelper.GetFloat("GAME_AUTO_FIGHT_BREAK_RECOVER_TIME");

                if (isShowTips == true)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("AUTO_FIGHT_PAUSE"));
                }
            }
        }
示例#3
0
        void Init()
        {
            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_CLICK_BUTTON, OnClick);
            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_PRESS_BUTTON, OnPress);
            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_RELEASE_BUTTON, OnRelease);

            m_skills_using_array = null;
            m_skills_info_array  = null;

            m_rockButtonTipsInterval = GameConstHelper.GetFloat("GAME_ROCK_BUTTON_TIPS_INTERVAL");
        }
示例#4
0
        protected override void InitAOIData(xc.UnitCacheInfo info)
        {
            base.InitAOIData(info);

            if (ActorManager.Instance.WorshipModelSet.ContainsKey(info.UnitID) == false)
            {
                ActorManager.Instance.WorshipModelSet.Add(info.UnitID, this);
            }
            else
            {
                GameDebug.LogError("WorshipModel has conflict key " + info.UnitID.obj_idx);
            }

            float touchRadius = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_TOUCH_RADIUS");

            mTouchSqrRadius = touchRadius * touchRadius;
        }
示例#5
0
        /// <summary>
        /// 任务更新事件协程,避免短时间内多次刷新任务,造成卡顿
        /// </summary>
        static void StartTaskChangedCoroutine()
        {
            if (mTaskChangedCoroutine != null)
            {
                mTaskChangedCoroutine.Stop();
                mTaskChangedCoroutine = null;
            }

            if (mTaskChangedCoroutineDelayTime < 0f)
            {
                mTaskChangedCoroutineDelayTime = GameConstHelper.GetFloat("GAME_TASK_CHANGED_EVENT_DELAY");
            }

            // 如果配置成0,则立刻刷新
            if (mTaskChangedCoroutineDelayTime == 0f)
            {
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null);
            }
            else
            {
                mTaskChangedCoroutine = SafeCoroutine.CoroutineManager.StartCoroutine(TaskChangedCoroutine());
            }
        }
        void OnModelChange(CEventBaseArgs param)
        {
            WorshipModel owner = mOwner as WorshipModel;

            if (owner == null)
            {
                return;
            }

            // 头顶名字
            if (mTextComponent != null)
            {
                UnityEngine.Object.DestroyImmediate(mTextComponent);
            }
            mTextComponent = mOwner.GetModelParent().AddComponent <UI3DText>();
            UI3DText.StyleInfo styleInfo = new UI3DText.StyleInfo();
            float modelScale             = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_SCALE");

            styleInfo.HeadOffset   = new Vector3(0f, mOwner.Height * modelScale, 0f);
            styleInfo.ScreenOffset = UI3DText.NameTextScreenOffset * modelScale;
            mTextComponent.SetHeadTrans(mOwner.GetModelParent().transform);
            mTextComponent.ResetStyleInfo(styleInfo);
            string text = "<color=#ffc319>" + owner.Rank.ToString();

            if (owner.Rank == 1)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_1"); // "st雕像";
            }
            else if (owner.Rank == 2)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_2");  //"nd雕像";
            }
            else if (owner.Rank == 3)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_3");  //"rd雕像";
            }
            else
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_4");  //"th雕像";
            }
            text = text + "</color>";
            mTextComponent.RankTextLabel = text;
            mTextComponent.FontSize      = 22;
            if (string.IsNullOrEmpty(owner.GuildName) == false)
            {
                mTextComponent.GuildNameTextLabel = "<color=#4ef269><" + owner.GuildName + "></color>";
            }
            mTextComponent.Text = "<color=#5ec4ff>" + owner.UserName + "</color>";

            // 膜拜按钮
            if (mWorshipButtonComponent != null)
            {
                UnityEngine.Object.DestroyImmediate(mWorshipButtonComponent);
            }
            mWorshipButtonComponent = mOwner.GetModelParent().AddComponent <UI3DText>();
            styleInfo              = new UI3DText.StyleInfo();
            modelScale             = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_SCALE");
            styleInfo.HeadOffset   = Vector3.zero;
            styleInfo.ScreenOffset = Vector3.zero;
            mWorshipButtonComponent.SetHeadTrans(ModelHelper.FindChildInHierarchy(mOwner.GetModelParent().transform, "root_node"));
            mWorshipButtonComponent.ResetStyleInfo(styleInfo);
            mWorshipButtonComponent.SetButtonStyle("MainWindow_New@Chatting@Praisebtn", DBConstText.GetText("WORSHIP"), 24, new Color(0.2f, 0.2f, 0.2f), new Vector3(0f, -9f, 0f));
            UnityEngine.UI.Image buttonImage = mWorshipButtonComponent.ButtonImage;
            if (buttonImage != null)
            {
                buttonImage.sprite = mWorshipButtonComponent.LoadSprite("MainWindow_New@Chatting@Hands");
                buttonImage.SetNativeSize();
                buttonImage.transform.localPosition = new Vector3(75, 40, 0);
                xc.ui.ugui.TweenPosition tween = xc.ui.ugui.TweenPosition.Begin(buttonImage.gameObject, 0.8f, new Vector3(100, 55, 0));
                tween.style = ui.ugui.UITweener.Style.PingPong;
                buttonImage.gameObject.SetActive(false);
            }
            mWorshipButtonComponent.SetClickCallback(() =>
            {
                mWorshipButtonComponent.ShowButton(false);
                if (buttonImage != null)
                {
                    buttonImage.gameObject.SetActive(false);
                }

                var data  = new C2SPlayerWorship();
                data.rank = owner.Rank;
                NetClient.GetBaseClient().SendData <C2SPlayerWorship>(NetMsg.MSG_PLAYER_WORSHIP, data);

                Actor localPlayer = Game.Instance.GetLocalPlayer();
                if (localPlayer != null)
                {
                    localPlayer.AttackCtrl.Attack(GameConstHelper.GetUint("GAME_DUNGEON_WORSHIP_SKILL_ID"));
                }
            });
            mWorshipButtonComponent.ShowButton(false);

            mTextComponent.Honor = mOwner.Honor;
            mTextComponent.Title = mOwner.Title;
        }
 public ActorModelCullManager()
 {
     mNpcMaxVisibleDistanceSquare = GameConstHelper.GetFloat("GAME_MWAR_NPC_MAX_VISIBLE_DISTANCE_SQUARE");
 }
        public IAudioTrack GetAudioTrack(SoundType type)
        {
            IAudioTrack audio;

            if (!audioTrack.TryGetValue(type, out audio))
            {
                AudioMixerGroup audioMixerGroup;
                audioMixerGroups.TryGetValue(type.ToString(), out audioMixerGroup);
                switch (type)
                {
                case SoundType.LocalPlayer:
                    audio = new NormalTrack(go, audioMixerGroup);
                    break;

                case SoundType.Boss:
                case SoundType.Monster:
                    audio = new FrequencyAndQuantityLimit(go, audioMixerGroup, GameConstHelper.GetInt("MONSTER_GROUP_SOUND_NUM"), GameConstHelper.GetFloat("MONSTER_GROUP_SOUND_INTERVAL"));
                    break;

                case SoundType.Voice:
                    audio = new OneClipPerTime(go, audioMixerGroup);
                    break;

                case SoundType.NPC:
                    audioMixerGroups.TryGetValue(SoundType.Voice.ToString(), out audioMixerGroup);
                    audio = new OneClipPerTimeInterruption(go, audioMixerGroup);
                    break;

                default:
                    audio = new NormalTrack(go, audioMixerGroup);
                    break;
                }

                audioTrack.Add(type, audio);
            }
            return(audio);
        }