Exemplo n.º 1
0
        private void OnRecvSpellHit(MessageReceivedEvent e)
        {
            // 发送给承受伤害或治疗的角色处理
            S2C_SpellHit ret = MarshalConversion.PtrToStruct <S2C_SpellHit>(e.MessagePtr);

            if (ret.TargetId == GameEngine.EngineInstance.LocalPlayer.CharacterID)
            {
                GameEngine.EngineInstance.LocalPlayer.OnSpellHit(ret);

                GameHud.Instance.DamageListener.PushHitElement(GameEngine.EngineInstance.LocalPlayer, ret);
            }
            else
            {
                RemoteCharacterController rcc = GameEngine.EngineInstance.FindCharacterController(ret.TargetId);
                if (rcc != null)
                {
                    rcc.OnSpellHit(ret);

                    GameHud.Instance.DamageListener.PushHitElement(rcc, ret);
                }
                else
                {
                    NLogger.Instance.WriteString(LogType.Warning, string.Format("S2C_SpellHit can not find controller UintID=[{0}]", ret.TargetId));
                }
            }
        }
Exemplo n.º 2
0
        private string FormatSpellHitMessage(S2C_SpellHit hit)
        {
            string ret = string.Empty;

            //if ((hit.Flag & (Byte)SpellHitResult.Hit) != 0)
            {
                ret = hit.Value.ToString();
            }

            return(ret);
        }
Exemplo n.º 3
0
        public void PushHitElement(GameCharacterController cc, S2C_SpellHit hit)
        {
            string message = FormatSpellHitMessage(hit);

            if (!string.IsNullOrEmpty(message))
            {
                ScreenDamageInfo info   = new ScreenDamageInfo(cc, message);
                Rect             fontRC = font.MeasureString(info.DamageMessage, DrawTextFormat.Center);
                info.InitSize = new Vector2(fontRC.Width, fontRC.Height);
                damageInfos.Add(info);
            }
        }
 /// <summary>
 /// 技能命中信息(需要广播)
 /// </summary>
 internal virtual void OnSpellHit(S2C_SpellHit ret)
 {
 }