Exemplo n.º 1
0
        /// <summary>
        /// 属性是否需要同步到客户端
        /// </summary>
        private bool IsNeedSyncClient(eUnitModType type)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_type:
            case eUnitModType.UMT_char_name:
            case eUnitModType.UMT_flags:
            case eUnitModType.UMT_model_idx:
            case eUnitModType.UMT_job:
            case eUnitModType.UMT_level:
            case eUnitModType.UMT_exp:
            case eUnitModType.UMT_gold:
            case eUnitModType.UMT_coin:
            case eUnitModType.UMT_hp:
            case eUnitModType.UMT_vip_grade:
            case eUnitModType.UMT_vip_flags:
            case eUnitModType.UMT_base_hurt:
            case eUnitModType.UMT_base_run_speed:
            case eUnitModType.UMT_base_energy:
            case eUnitModType.UMT_hp_max:
            case eUnitModType.UMT_energy_max:
            case eUnitModType.UMT_hurt:
            case eUnitModType.UMT_range:
            case eUnitModType.UMT_run_speed:
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 属性改变
        /// </summary>
        public void UpdateAttribute(eUnitModType type, long value)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_type: m_player_data.char_type = (byte)value; break;

            case eUnitModType.UMT_flags: m_player_data.flags = (uint)value; break;

            case eUnitModType.UMT_model_idx: m_player_data.model_idx = (uint)value; break;

            case eUnitModType.UMT_job: m_player_data.job = (byte)value; break;

            case eUnitModType.UMT_level: m_player_data.level = (ushort)value; break;

            case eUnitModType.UMT_exp: m_player_data.exp = (uint)value; break;

            case eUnitModType.UMT_gold: m_player_data.gold = (uint)value; break;

            case eUnitModType.UMT_coin: m_player_data.coin = (uint)value; break;

            case eUnitModType.UMT_vip_grade: m_player_data.vip_grade = (uint)value; break;

            default: return;
            }
            m_last_active_time = Time.timeSinceStartup;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 属性改变
        /// </summary>
        public void UpdateAttribute(eUnitModType type, long value)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_type: m_player_data.char_type = (byte)value; break;

            case eUnitModType.UMT_flags: m_player_data.flags = (uint)value; break;

            case eUnitModType.UMT_scene_type: m_player_data.scene_type_idx = (uint)value; break;

            case eUnitModType.UMT_model_idx: m_player_data.model_idx = (uint)value; break;

            case eUnitModType.UMT_job: m_player_data.job = (byte)value; break;

            case eUnitModType.UMT_level: m_player_data.level = (ushort)value; break;

            case eUnitModType.UMT_exp: m_player_data.exp = (uint)value; break;

            case eUnitModType.UMT_gold: m_player_data.gold = (uint)value; break;

            case eUnitModType.UMT_coin: m_player_data.coin = (uint)value; break;

            case eUnitModType.UMT_vip_grade: m_player_data.vip_grade = (uint)value; break;

            default: return;
            }
            RelationManager.Instance.UpdateAttribute(m_char_idx, type, value);
            m_is_dirty         = true;
            m_last_access_time = Time.second_time;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 属性改变
        /// </summary>
        public void UpdateAttribute(long char_idx, eUnitModType type, long value)
        {
            RelationInfo info = GetRelation(char_idx);

            if (info == null)
            {
                return;
            }

            switch (type)
            {
            case eUnitModType.UMT_char_type: info.char_type = (byte)value; break;

            case eUnitModType.UMT_model_idx: info.model_idx = (uint)value; break;

            case eUnitModType.UMT_job: info.job = (byte)value; break;

            case eUnitModType.UMT_level: info.level = (ushort)value; break;

            case eUnitModType.UMT_exp: info.exp = (uint)value; break;

            case eUnitModType.UMT_gold: info.gold = (uint)value; break;

            case eUnitModType.UMT_coin: info.coin = (uint)value; break;

            case eUnitModType.UMT_vip_grade: info.vip_grade = (uint)value; break;

            default: return;
            }
        }
Exemplo n.º 5
0
        private void Send2Client(eUnitModType type, PackBaseS2C msg)
        {
            eUnitAttrObserver oberver = this.GetObserverType(type);

            switch (oberver)
            {
            case eUnitAttrObserver.Single:
                ServerNetManager.Instance.SendProxy(msg.client_uid, msg, false);
                break;

            case eUnitAttrObserver.BoardcaseScreen:
            {
                ServerNetManager.Instance.SendProxy(msg.client_uid, msg, false);
                //转发其他同屏玩家
                List <long> list_unit = AOIManager.Instance.GetScreenUnit(m_owner_unit.obj_idx);
                if (list_unit != null && list_unit.Count > 0)
                {
                    foreach (var idx in list_unit)
                    {
                        Player player = UnitManager.Instance.GetUnitByIdx(idx) as Player;
                        if (player == null)
                        {
                            continue;
                        }
                        ServerNetManager.Instance.SendProxy(player.client_uid, msg, false);
                    }
                }
            }
            break;

            case eUnitAttrObserver.Boardcase:
                ServerNetManager.Instance.SendProxy(msg.client_uid, msg, true);
                break;
            }
        }
Exemplo n.º 6
0
 public override void Read(ByteArray by)
 {
     base.Read(by);
     char_idx = by.ReadLong();
     type     = (eUnitModType)by.ReadUShort();
     value    = by.ReadString();
 }
Exemplo n.º 7
0
 /// <summary>
 /// 属性是否需要同步到fs:每次战斗,都会发一份最新数据给战斗服,所以一般数据不需要同步给fs,除非是战斗中可以改变的数据
 /// </summary>
 private bool IsNeedSyncFS(eUnitModType type)
 {
     switch (type)
     {
     default:
         return(false);
     }
 }
Exemplo n.º 8
0
 public void UpdateAttribute(eUnitModType type, string value)
 {
     switch (type)
     {
     default: return;
     }
     //m_last_active_time = Time.timeSinceStartup;
 }
Exemplo n.º 9
0
 public override void Read(ByteArray by)
 {
     base.Read(by);
     unit_idx.Read(by);
     action = (eUnitAttrAction)by.ReadUShort();
     type   = (eUnitModType)by.ReadUShort();
     value  = by.ReadString();
 }
Exemplo n.º 10
0
        public void UpdateAttribute(long char_idx, eUnitModType type, string value)
        {
            MemberRelation member = null;

            foreach (var obj in m_cache_members)
            {
                member = obj.Value;
                member.UpdateAttribute(char_idx, type, value);
            }
        }
Exemplo n.º 11
0
        public void UpdateAttribute(eUnitModType type, string value)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_name: m_player_data.char_name = value; break;

            default: return;
            }
            m_last_active_time = Time.timeSinceStartup;
        }
Exemplo n.º 12
0
        /// <summary>
        /// 发给db-string
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nValue"></param>
        private void Send2DB(eUnitModType type, string nValue)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return;
            }

            player.SetDirty();
        }
Exemplo n.º 13
0
        public override long GetAttribInteger(eUnitModType type)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return(0);
            }

            switch (type)
            {
            case eUnitModType.UMT_char_type: return(m_player_info.char_type);

            case eUnitModType.UMT_fs_uid: return(m_player_info.fs_id);

            case eUnitModType.UMT_flags: return(m_player_info.flags);

            case eUnitModType.UMT_model_idx: return(m_player_info.model_idx);

            case eUnitModType.UMT_job: return(m_player_info.job);

            case eUnitModType.UMT_level: return(m_player_info.level);

            case eUnitModType.UMT_exp: return(m_player_info.exp);

            case eUnitModType.UMT_energy: return(m_player_info.energy);

            case eUnitModType.UMT_gold: return(m_player_info.gold);

            case eUnitModType.UMT_coin: return(m_player_info.coin);

            case eUnitModType.UMT_hp: return(m_player_info.hp);

            case eUnitModType.UMT_vip_grade: return(m_player_info.vip_grade);

            case eUnitModType.UMT_vip_flags: return(m_player_info.vip_flags);

            case eUnitModType.UMT_base_energy: return(m_player_info.energy);

            case eUnitModType.UMT_base_hurt: return(m_player_info.hurt);

            case eUnitModType.UMT_base_run_speed: return(m_player_info.run_speed);

            case eUnitModType.UMT_hp_max: return(m_player_info.hp_max);

            case eUnitModType.UMT_hurt: return(m_player_info.hurt);

            case eUnitModType.UMT_range: return(m_player_info.range);

            case eUnitModType.UMT_run_speed: return(m_player_info.run_speed);

            default: return(0);
            }
        }
Exemplo n.º 14
0
        public void UpdateAttribute(eUnitModType type, string value)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_name: m_player_data.char_name = value; break;

            default: return;
            }
            RelationManager.Instance.UpdateAttribute(m_char_idx, type, value);
            m_is_dirty         = true;
            m_last_access_time = Time.second_time;
        }
Exemplo n.º 15
0
        public static void SendUnitModifyString(eUnitModType type, string value)
        {
            if (!CheckLogin())
            {
                return;
            }

            c2ss.NotifyUpdatePlayerAttribString msg = PacketPools.Get(c2ss.msg.UNIT_MODIFY_STRING) as c2ss.NotifyUpdatePlayerAttribString;
            msg.type  = type;
            msg.value = value;
            ClientNetManager.Instance.Send(msg);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 属性改变
        /// </summary>
        public static void SendUnitModifyInt(eUnitModType type, long value)
        {
            if (!CheckLogin())
            {
                return;
            }

            c2ss.NotifyUpdatePlayerAttribInteger msg = PacketPools.Get(c2ss.msg.UNIT_MODIFY_INT) as c2ss.NotifyUpdatePlayerAttribInteger;
            msg.type  = type;
            msg.value = value;
            ClientNetManager.Instance.Send(msg);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 属性改变
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public void UpdateAttribute(eUnitModType type, long value)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_type: m_ss_data.char_type = (byte)value; break;

            case eUnitModType.UMT_flags: m_ss_data.flags = (uint)value; break;

            case eUnitModType.UMT_model_idx: m_ss_data.model_idx = (uint)value; break;

            case eUnitModType.UMT_job: m_ss_data.job = (byte)value; break;

            case eUnitModType.UMT_level: m_ss_data.level = (ushort)value; break;

            case eUnitModType.UMT_exp: m_ss_data.exp = (uint)value; break;

            case eUnitModType.UMT_energy: m_ss_data.energy = (uint)value; break;

            case eUnitModType.UMT_gold: m_ss_data.gold = (uint)value; break;

            case eUnitModType.UMT_coin: m_ss_data.coin = (uint)value; break;

            case eUnitModType.UMT_hp: m_ss_data.hp = (uint)value; break;

            case eUnitModType.UMT_vip_grade: m_ss_data.vip_grade = (uint)value; break;

            case eUnitModType.UMT_vip_flags: m_ss_data.vip_flags = (uint)value; break;

            case eUnitModType.UMT_time_last_login: m_ss_data.time_last_login = value; break;

            case eUnitModType.UMT_time_last_logout: m_ss_data.time_last_logout = value; break;

            case eUnitModType.UMT_base_energy: m_ss_data.energy = (uint)value; break;

            case eUnitModType.UMT_base_hurt: m_ss_data.hurt = (uint)value; break;

            case eUnitModType.UMT_base_run_speed: m_ss_data.run_speed = (uint)value; break;

            case eUnitModType.UMT_hp_max: m_ss_data.hp_max = (uint)value; break;

            case eUnitModType.UMT_hurt: m_ss_data.hurt = (uint)value; break;

            case eUnitModType.UMT_range: m_ss_data.range = (uint)value; break;

            case eUnitModType.UMT_run_speed: m_ss_data.run_speed = (uint)value; break;

            default: return;
            }
            m_is_dirty         = true;
            m_last_access_time = Time.timeSinceStartup;
        }
Exemplo n.º 18
0
            public void Read(ByteArray by)
            {
                type = (eUnitModType)by.ReadUShort();
                switch (type)
                {
                case eUnitModType.UMT_char_name:
                    value_str = by.ReadString();
                    break;

                default:
                    value_i = by.ReadLong();
                    break;
                }
            }
Exemplo n.º 19
0
        /// <summary>
        /// 发给ws
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nValue"></param>
        private void Send2WS(eUnitModType type, long nValue)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return;
            }

            ss2ws.NotifyUpdatePlayerAttribInteger msg = PacketPools.Get(ss2ws.msg.UNIT_MODIFY_INT) as ss2ws.NotifyUpdatePlayerAttribInteger;
            msg.char_idx = player.char_idx;
            msg.type     = type;
            msg.value    = nValue;
            ServerNetManager.Instance.Send2WS(msg);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 发给fs-string
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nValue"></param>
        private void Send2FS(eUnitModType type, string nValue)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return;
            }

            ss2fs.NotifyUpdatePlayerAttribString msg = PacketPools.Get(ss2fs.msg.UNIT_MODIFY_STRING) as ss2fs.NotifyUpdatePlayerAttribString;
            msg.char_idx = player.char_idx;
            msg.type     = type;
            msg.value    = nValue;
            ServerNetManager.Instance.Send2FS(player.fs_uid, msg);
        }
Exemplo n.º 21
0
        public void UpdateAttribute(long char_idx, eUnitModType type, string value)
        {
            RelationInfo info = GetRelation(char_idx);

            if (info == null)
            {
                return;
            }

            switch (type)
            {
            case eUnitModType.UMT_char_name: info.char_name = value; break;

            default: return;
            }
        }
Exemplo n.º 22
0
        public override string GetAttribString(eUnitModType type)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return("");
            }

            switch (type)
            {
            case eUnitModType.UMT_char_name: return(m_player_info.char_name);

            default: return("");
            }
        }
Exemplo n.º 23
0
        public override eUnitAttrObserver GetObserverType(eUnitModType type)
        {
            eUnitAttrObserver observer = eUnitAttrObserver.Single;

            switch (type)
            {
            case eUnitModType.UMT_char_type:
            case eUnitModType.UMT_model_idx:
            case eUnitModType.UMT_level:
            case eUnitModType.UMT_gold:
            case eUnitModType.UMT_coin:
            case eUnitModType.UMT_vip_grade:
                observer = eUnitAttrObserver.BoardcaseScreen;
                break;
            }
            return(observer);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 发给客户端-string
        /// </summary>
        /// <param name="type"></param>
        /// <param name="nValue"></param>
        private void Send2Client(eUnitModType type, string nValue, eUnitAttrAction action)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return;
            }

            ss2c.NotifyUpdatePlayerAttribString msg = PacketPools.Get(ss2c.msg.UNIT_MODIFY_STRING) as ss2c.NotifyUpdatePlayerAttribString;
            msg.client_uid = player.client_uid;
            msg.unit_idx.Set(player.unit_type, player.obj_type, player.char_idx);
            msg.action = action;
            msg.type   = type;
            msg.value  = nValue;
            Send2Client(type, msg);
        }
Exemplo n.º 25
0
        public bool SetAttrib(eUnitModType type, long nValue, string strValue, bool sync_db = true, bool sync_client = true, bool sync_ws = true, bool sync_gl = true, bool sync_fs = true, eUnitAttrAction action = eUnitAttrAction.Unknow)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return(false);
            }

            switch (type)
            {
            case eUnitModType.UMT_char_name:
                return(SetAttribString(type, strValue, sync_db, sync_client, sync_ws, sync_gl, sync_fs, action));

            default:
                return(SetAttribInteger(type, nValue, sync_db, sync_client, sync_ws, sync_gl, sync_fs, action));
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 属性是否需要同步到gl
        /// </summary>
        private bool IsNeedSyncGL(eUnitModType type)
        {
            switch (type)
            {
            case eUnitModType.UMT_char_type:
            case eUnitModType.UMT_char_name:
            case eUnitModType.UMT_flags:
            case eUnitModType.UMT_model_idx:
            case eUnitModType.UMT_job:
            case eUnitModType.UMT_level:
            case eUnitModType.UMT_exp:
            case eUnitModType.UMT_gold:
            case eUnitModType.UMT_coin:
            case eUnitModType.UMT_vip_grade:
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 27
0
        public override bool SetAttribString(eUnitModType type, string nValue, bool sync_db = true, bool sync_client = true, bool sync_ws = true, bool sync_gl = true, bool sync_fs = true, eUnitAttrAction action = eUnitAttrAction.Unknow)
        {
            Player player = m_owner_unit as Player;

            if (player == null)
            {
                return(false);
            }

            switch (type)
            {
            case eUnitModType.UMT_char_name: m_player_info.char_name = nValue; break;

            default: return(false);
            }

            if (sync_client && IsNeedSyncClient(type))
            {
                Send2Client(type, nValue, action);
            }
            if (sync_db)
            {
                Send2DB(type, nValue);
            }
            if (sync_ws && IsNeedSyncWS(type))
            {
                Send2WS(type, nValue);
            }
            if (sync_gl && IsNeedSyncGL(type))
            {
                Send2GL(type, nValue);
            }
            if (sync_fs && IsNeedSyncFS(type))
            {
                Send2FS(type, nValue);
            }
            return(true);
        }
Exemplo n.º 28
0
 private void OnBtnOk(object sender, EventArgs e)
 {
     if (m_com_name.SelectedIndex > 0 && m_txt_value.Text.Trim().Length > 0)
     {
         bool         is_string = false;
         string       value     = m_txt_value.Text.Trim();
         eUnitModType type      = (eUnitModType)m_com_name.SelectedIndex;
         switch (type)
         {
         case eUnitModType.UMT_char_name:
             is_string = true;
             break;
         }
         if (is_string)
         {
             ServerMsgSend.SendUnitModifyString(type, value);
         }
         else
         {
             ServerMsgSend.SendUnitModifyInt(type, long.Parse(value));
         }
     }
     this.Close();
 }
Exemplo n.º 29
0
 /// <summary>
 /// 是否全屏广播属性:全屏广播属性会广播给周围其他玩家,谨慎使用
 /// </summary>
 /// <returns></returns>
 public virtual eUnitAttrObserver GetObserverType(eUnitModType type)
 {
     return(eUnitAttrObserver.Single);
 }
Exemplo n.º 30
0
 public virtual bool SetAttribString(eUnitModType type, string nValue, bool sync_db = true, bool sync_client = true, bool sync_ws = true, bool sync_gl = true, bool sync_fs = true, eUnitAttrAction action = eUnitAttrAction.Unknow)
 {
     return(false);
 }