예제 #1
0
        public void ExecCommand(PoolObjHandle <ActorRoot> followActor, uint senderPlayerID, uint heroID, int signalID, byte bAlice = 0, byte elementType = 0, uint targetObjID = 0u, uint targetHeroID = 0u)
        {
            if (!this.m_useSignalButton || this.m_formScript == null)
            {
                return;
            }
            Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

            Player player = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(senderPlayerID);

            if (hostPlayer == null || player == null)
            {
                return;
            }
            if (hostPlayer.PlayerCamp != player.PlayerCamp)
            {
                return;
            }
            bool          flag      = hostPlayer == player;
            ResSignalInfo dataByKey = GameDataMgr.signalDatabin.GetDataByKey((long)signalID);

            if (dataByKey == null)
            {
                DebugHelper.Assert(dataByKey != null, "ExecCommand signalInfo is null, check out...");
                return;
            }
            uint  cDTime         = this.GetCDTime(dataByKey);
            ulong logicFrameTick = Singleton <FrameSynchr> .GetInstance().LogicFrameTick;

            SignalPanel.CPlayerSignalCooldown cPlayerSignalCooldown = null;
            this.m_playerSignalCooldowns.TryGetValue(senderPlayerID, ref cPlayerSignalCooldown);
            if (cPlayerSignalCooldown != null)
            {
                if ((uint)(logicFrameTick - cPlayerSignalCooldown.m_lastSignalExecuteTimestamp) < cPlayerSignalCooldown.m_cooldownTime)
                {
                    return;
                }
                cPlayerSignalCooldown.m_lastSignalExecuteTimestamp = logicFrameTick;
                cPlayerSignalCooldown.m_cooldownTime = cDTime;
            }
            else
            {
                cPlayerSignalCooldown = new SignalPanel.CPlayerSignalCooldown(logicFrameTick, cDTime);
                this.m_playerSignalCooldowns.Add(senderPlayerID, cPlayerSignalCooldown);
            }
            if (flag && this.m_signalButtons != null)
            {
                for (int i = 0; i < this.m_signalButtons.Length; i++)
                {
                    if (this.m_signalButtons[i] != null)
                    {
                        this.m_signalButtons[i].StartCooldown(cDTime);
                    }
                }
            }
            bool bSmall = Singleton <CBattleSystem> .instance.TheMinimapSys.CurMapType() == MinimapSys.EMapType.Mini;

            this.PlaySignalTipsSound(elementType, bAlice, targetHeroID);
            bool bUseCfgSound = elementType == 0;

            if (followActor && followActor.handle.Visible)
            {
                CSignal cSignal = new CSignal(followActor, signalID, true, bSmall, bUseCfgSound);
                cSignal.Initialize(this.m_formScript, dataByKey);
                this.m_signals.Add(cSignal);
            }
            CSignalTips obj = new CSignalTips(signalID, heroID, flag, bAlice, elementType, targetHeroID);

            this.Add_SignalTip(obj);
        }
예제 #2
0
        public void ExecCommand_4_SignalPanel_Sign(PoolObjHandle <ActorRoot> sender, uint senderPlayerID, uint heroID, int signalID, int worldPositionX, int worldPositionY, int worldPositionZ)
        {
            if (!this.m_useSignalButton || this.m_formScript == null)
            {
                return;
            }
            Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

            Player player = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(senderPlayerID);

            if (hostPlayer == null || player == null)
            {
                return;
            }
            if (hostPlayer.PlayerCamp != player.PlayerCamp)
            {
                return;
            }
            bool          flag      = hostPlayer == player;
            ResSignalInfo dataByKey = GameDataMgr.signalDatabin.GetDataByKey((long)signalID);

            if (dataByKey == null)
            {
                DebugHelper.Assert(dataByKey != null, "ExecCommand signalInfo is null, check out...");
                return;
            }
            uint  cDTime         = this.GetCDTime(dataByKey);
            ulong logicFrameTick = Singleton <FrameSynchr> .GetInstance().LogicFrameTick;

            SignalPanel.CPlayerSignalCooldown cPlayerSignalCooldown = null;
            this.m_playerSignalCooldowns.TryGetValue(senderPlayerID, ref cPlayerSignalCooldown);
            if (cPlayerSignalCooldown != null)
            {
                if ((uint)(logicFrameTick - cPlayerSignalCooldown.m_lastSignalExecuteTimestamp) < cPlayerSignalCooldown.m_cooldownTime)
                {
                    return;
                }
                cPlayerSignalCooldown.m_lastSignalExecuteTimestamp = logicFrameTick;
                cPlayerSignalCooldown.m_cooldownTime = cDTime;
            }
            else
            {
                cPlayerSignalCooldown = new SignalPanel.CPlayerSignalCooldown(logicFrameTick, cDTime);
                this.m_playerSignalCooldowns.Add(senderPlayerID, cPlayerSignalCooldown);
            }
            if (flag && this.m_signalButtons != null)
            {
                for (int i = 0; i < this.m_signalButtons.Length; i++)
                {
                    if (this.m_signalButtons[i] != null)
                    {
                        this.m_signalButtons[i].StartCooldown(cDTime);
                    }
                }
            }
            Singleton <CSoundManager> .GetInstance().PlayBattleSound2D(dataByKey.szSound);

            MiniMapEffectModule miniMapEffectModule = Singleton <CBattleSystem> .instance.TheMinimapSys.miniMapEffectModule;

            if (miniMapEffectModule != null)
            {
                Vector3    vector     = new Vector3((float)worldPositionX, (float)worldPositionY, (float)worldPositionZ);
                GameObject gameObject = miniMapEffectModule.PlaySceneEffect(dataByKey.szSceneEffect, (int)dataByKey.bTime * 1000, vector);
                if (signalID == 202 && gameObject != null)
                {
                    TextMesh component = gameObject.transform.FindChild("text").GetComponent <TextMesh>();
                    if (component != null)
                    {
                        ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroID);
                        if (dataByKey2 == null)
                        {
                            return;
                        }
                        component.text = dataByKey2.szName;
                        component.gameObject.CustomSetActive(true);
                    }
                    Transform transform = gameObject.transform.FindChild("JianTou");
                    Vector3   forward   = sender.handle.gameObject.transform.position - vector;
                    forward.Normalize();
                    transform.forward = forward;
                    if (Singleton <BattleLogic> .instance.m_LevelContext.m_isCameraFlip)
                    {
                        component.transform.rotation = Quaternion.AngleAxis(180f, Vector3.up);
                    }
                }
                if (signalID == 203 && Singleton <BattleLogic> .instance.m_LevelContext.m_isCameraFlip)
                {
                    gameObject.transform.rotation = Quaternion.AngleAxis(180f, Vector3.up);
                }
                if (!string.IsNullOrEmpty(dataByKey.szRealEffect))
                {
                    bool       bMiniMap      = false;
                    MinimapSys theMinimapSys = Singleton <CBattleSystem> .GetInstance().TheMinimapSys;

                    if (theMinimapSys != null)
                    {
                        bMiniMap = (theMinimapSys.CurMapType() == MinimapSys.EMapType.Mini);
                    }
                    Vector2 screenPos = MiniMapSysUT.CalcScreenPosInMapByWorldPos(ref vector, bMiniMap);
                    miniMapEffectModule.PlayScreenPosEffect(dataByKey.szRealEffect, (float)((int)dataByKey.bTime * 1000), screenPos);
                }
            }
        }