757 lines
30 KiB
C#
757 lines
30 KiB
C#
|
using ProtoBuf;
|
|||
|
using Thousandto.Plugins.Common;
|
|||
|
using MSG_Map;
|
|||
|
using UnityEngine;
|
|||
|
using Thousandto.Cfg.Data;
|
|||
|
using Thousandto.Core.Asset;
|
|||
|
using Thousandto.Code.Center;
|
|||
|
using Thousandto.Code.Global;
|
|||
|
using Thousandto.Plugins.Common.UniScene;
|
|||
|
|
|||
|
namespace Thousandto.Code.Logic.Network
|
|||
|
{
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 实现消息的回调方法 --- 地图协议,同步所有玩家,怪物,NPC的信息
|
|||
|
/// </summary>
|
|||
|
public partial class HandleMsgResult : IHandleMsgResult
|
|||
|
{
|
|||
|
//进入某个地图
|
|||
|
//ChangeMapResult_Success = 0; //传送成功
|
|||
|
//ChangeMapResult_Failed_None = -1; //未知原因
|
|||
|
//ChangeMapResult_Failed_PlayerOverflow = -2; //地图人数已满
|
|||
|
//ChangeMapResult_Failed_PlayerDie = -3; //死亡中不能传送
|
|||
|
//ChangeMapResult_Failed_DistanceLong = -4; //距离太远
|
|||
|
//ChangeMapResult_Failed_ToCopyMap = -5; //不能传送到副本地图
|
|||
|
//ChangeMapResult_Failed_UnFind = -6; //没有找到目标地图
|
|||
|
//ChangeMapResult_Failed_Battle = -7; //战斗状态不能切换
|
|||
|
//ChangeMapResult_Failed_Team = -8; //组队状态不能进入
|
|||
|
//ChangeMapResult_Failed_LocationCopyMap = -9; //副本中不能传送
|
|||
|
public void GS2U_ResEnterMap(ResEnterMap result)
|
|||
|
{
|
|||
|
if (result.result < 0)
|
|||
|
{
|
|||
|
switch (result.result)
|
|||
|
{
|
|||
|
case -1:
|
|||
|
//GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_NONE));
|
|||
|
break;
|
|||
|
case -2:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_FULL));
|
|||
|
break;
|
|||
|
case -3:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_DEAD));
|
|||
|
break;
|
|||
|
case -4:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_LONG));
|
|||
|
break;
|
|||
|
case -5:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_COPY));
|
|||
|
break;
|
|||
|
case -6:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_UNFIND));
|
|||
|
break;
|
|||
|
case -7:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_FIGHT));
|
|||
|
break;
|
|||
|
case -8:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_TEAM));
|
|||
|
break;
|
|||
|
case -9:
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(DeclareMessageString.Get(DeclareMessageString.C_CHANGEMAP_FAILED_COPYMAP));
|
|||
|
break;
|
|||
|
case -12:
|
|||
|
{
|
|||
|
GameCenter.TaskController.ResumeForTransPort();
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UI_WAITING_CLOSE);
|
|||
|
GameCenter.PathSearchSystem.EraseAll();
|
|||
|
return;
|
|||
|
}
|
|||
|
LocalPlayer lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
if (lp == null)
|
|||
|
return;
|
|||
|
DeclareMapsetting cfg = DeclareMapsetting.Get(result.mapDataID);
|
|||
|
if (cfg == null)
|
|||
|
return;
|
|||
|
lp.ForcedStop_Action();
|
|||
|
GameCenter.LuaSystem.Adaptor.EndMandate();
|
|||
|
lp.skillManager.Clear();
|
|||
|
|
|||
|
GameCenter.ReconnectSystem.LastPlayerPos = lp.Position;
|
|||
|
GameCenter.GameSceneSystem.StartChangeToMap(result.mapDataID, result.line, new Vector2((float)result.pos.x, (float)result.pos.y), result.type, result.param);
|
|||
|
}
|
|||
|
|
|||
|
//返回视线范围之内的所有其他对象
|
|||
|
public void GS2U_ResRoundObjs(ResRoundObjs result)
|
|||
|
{
|
|||
|
var scene = GameCenter.GameSceneSystem.GetActivedScene();
|
|||
|
var lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
|
|||
|
if (scene == null || lp == null)
|
|||
|
return;
|
|||
|
|
|||
|
MSG_Map.ResRoundObjs msg = result;
|
|||
|
if (scene.Entities != null)
|
|||
|
{
|
|||
|
//删除对象
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntities(msg.removeIds);
|
|||
|
|
|||
|
//增加NPC
|
|||
|
for (int i = 0; i < msg.npcs.Count; ++i)
|
|||
|
{
|
|||
|
NpcInitInfo info = new NpcInitInfo(msg.npcs[i]);
|
|||
|
GameCenter.GameSceneSystem.RefreshNpc(info);
|
|||
|
}
|
|||
|
|
|||
|
//增加player
|
|||
|
for (int i = 0; i < msg.players.Count; ++i)
|
|||
|
{
|
|||
|
if (lp.ID == msg.players[i].playerId)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
var info = new RemotePlayerInitInfo(msg.players[i]);
|
|||
|
GameCenter.GameSceneSystem.RefreshRemotePlayer(info);
|
|||
|
}
|
|||
|
|
|||
|
//增加monster
|
|||
|
for (int i = 0; i < msg.monsters.Count; ++i)
|
|||
|
{
|
|||
|
//DeclareMonster cfg = DeclareMonster.Get(msg.monsters[i].dataID);
|
|||
|
//if (cfg != null)
|
|||
|
//{
|
|||
|
// if (cfg.MonsterType == 8)
|
|||
|
// {
|
|||
|
// var info = new BrokenObjInitInfo(msg.monsters[i]);
|
|||
|
// GameCenter.GameSceneSystem.RefreshBrokenObj(info);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// var info = new MonsterInitInfo(msg.monsters[i]);
|
|||
|
// GameCenter.GameSceneSystem.RefreshMonster(info);
|
|||
|
// }
|
|||
|
//}
|
|||
|
var info = new MonsterInitInfo(msg.monsters[i]);
|
|||
|
GameCenter.GameSceneSystem.RefreshMonster(info);
|
|||
|
}
|
|||
|
|
|||
|
//增加采集物
|
|||
|
for (int i = 0; i < msg.gathers.Count; ++i)
|
|||
|
{
|
|||
|
CollectionInitInfo info = new CollectionInitInfo(msg.gathers[i]);
|
|||
|
GameCenter.GameSceneSystem.RefreshCollection(info);
|
|||
|
}
|
|||
|
|
|||
|
////增加墓碑
|
|||
|
//for (int i = 0; i < msg.tombstone.Count; i++)
|
|||
|
//{
|
|||
|
// TombstoneInitInfo info = new TombstoneInitInfo(msg.tombstone[i]);
|
|||
|
// GameCenter.GameSceneSystem.RefreshTombstone(info);
|
|||
|
//}
|
|||
|
|
|||
|
//增加宠物
|
|||
|
for (int i = 0; i < msg.pets.Count; ++i)
|
|||
|
{
|
|||
|
PetInitInfo info = new PetInitInfo(msg.pets[i]);
|
|||
|
GameCenter.GameSceneSystem.RefreshPet(info);
|
|||
|
}
|
|||
|
|
|||
|
////增加技能对象
|
|||
|
//for (int i = 0; i < msg.magics.Count; ++i)
|
|||
|
//{
|
|||
|
// SkillObjectInitInfo info = new SkillObjectInitInfo(msg.magics[i]);
|
|||
|
// GameCenter.GameSceneSystem.RefreshSkillObject(info);
|
|||
|
//}
|
|||
|
|
|||
|
////增加篝火对象
|
|||
|
//for (int i = 0; i < msg.bonfires.Count; ++i)
|
|||
|
//{
|
|||
|
// BonfireInfo info = new BonfireInfo(msg.bonfires[i]);
|
|||
|
// GameCenter.GameSceneSystem.RefreshBonFires(info);
|
|||
|
//}
|
|||
|
|
|||
|
//增加地面buff对象
|
|||
|
for (int i = 0; i < msg.groundBuff.Count; ++i)
|
|||
|
{
|
|||
|
GroundBuffInitInfo info = new GroundBuffInitInfo(msg.groundBuff[i]);
|
|||
|
GameCenter.GameSceneSystem.RefreshGroundBuff(info);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//其他玩家信息
|
|||
|
public void GS2U_ResMapPlayer(ResMapPlayer msg)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshRemotePlayer(new RemotePlayerInitInfo(msg.player));
|
|||
|
}
|
|||
|
//某个对象停止移动
|
|||
|
public void GS2U_ResStopMove(ResStopMove result)
|
|||
|
{
|
|||
|
NetHandler.OnResStopMove(result);
|
|||
|
}
|
|||
|
//某个对象移动到
|
|||
|
public void GS2U_ResMoveTo(ResMoveTo msg)
|
|||
|
{
|
|||
|
NetHandler.OnResMoveTo(msg);
|
|||
|
}
|
|||
|
//某个玩家跳跃
|
|||
|
public void GS2U_ResJump(ResJump msg)
|
|||
|
{
|
|||
|
NetHandler.OnResJump(msg);
|
|||
|
}
|
|||
|
|
|||
|
//从视线范围内移除某个玩家
|
|||
|
public void GS2U_ResPlayerDisappear(ResPlayerDisappear msg)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntities(msg.playerIds);
|
|||
|
}
|
|||
|
|
|||
|
//更新NPC信息
|
|||
|
public void GS2U_ResRoundNpcInfo(MSG_Map.ResRoundNpcInfo result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshNpc(new NpcInitInfo(result.npcInfo));
|
|||
|
}
|
|||
|
|
|||
|
//从视线范围内移除NPC
|
|||
|
public void GS2U_ResRoundNpcDisappear(MSG_Map.ResRoundNpcDisappear msg)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntities(msg.npcIds);
|
|||
|
}
|
|||
|
|
|||
|
//更新一个怪物信息
|
|||
|
public void GS2U_ResMapMonster(MSG_Map.ResMapMonster result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshMonster(new MonsterInitInfo(result.monserInfo));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//从视线范围内移除某个怪物
|
|||
|
public void GS2U_ResMonsterDisappear(MSG_Map.ResMonsterDisappear result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.monsterId);
|
|||
|
}
|
|||
|
|
|||
|
//更新一个宠物信息
|
|||
|
public void GS2U_ResPetBirth(MSG_Map.ResPetBirth result)
|
|||
|
{
|
|||
|
DeclarePet pet = DeclarePet.Get(result.pet.dataID);
|
|||
|
if (pet == null)
|
|||
|
return;
|
|||
|
GameCenter.GameSceneSystem.RefreshPet(new PetInitInfo(result.pet));
|
|||
|
}
|
|||
|
//从视线内移除某个宠物
|
|||
|
public void GS2U_ResPetDisappear(MSG_Map.ResPetDisappear result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.id);
|
|||
|
}
|
|||
|
|
|||
|
//某个对象往某个方向移动
|
|||
|
public void GS2U_ResDirMove(MSG_Map.ResDirMove result)
|
|||
|
{
|
|||
|
NetHandler.OnResDirMove(result);
|
|||
|
}
|
|||
|
|
|||
|
//采集信息更新
|
|||
|
public void GS2U_ResMapGatherInfo(MSG_Map.ResMapGatherInfo result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshCollection(new CollectionInitInfo(result.gatherInfo));
|
|||
|
|
|||
|
}
|
|||
|
//在视线范围内移除采集对象
|
|||
|
public void GS2U_ResGatherDisappear(MSG_Map.ResGatherDisappear result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.id);
|
|||
|
}
|
|||
|
|
|||
|
//打断采集
|
|||
|
public void GS2U_ResBreakGather(MSG_Map.ResBreakGather result)
|
|||
|
{
|
|||
|
LocalPlayer lp = GameCenter.GameSceneSystem.GetLocalPlayer();
|
|||
|
if (lp == null)
|
|||
|
return;
|
|||
|
|
|||
|
if (lp.Fsm.CurrentState is Collect)
|
|||
|
{
|
|||
|
lp.Stop_Action(false);
|
|||
|
Collect c = lp.Fsm.CurrentState as Collect;
|
|||
|
c.FinishTransition();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//对象复活
|
|||
|
public void GS2U_ResRelive(MSG_Map.ResRelive result)
|
|||
|
{
|
|||
|
NetHandler.OnResRelive(result);
|
|||
|
}
|
|||
|
|
|||
|
//移动速度改变
|
|||
|
public void GS2U_ResMoveSpeedChange(MSG_Map.ResMoveSpeedChange result)
|
|||
|
{
|
|||
|
if (GameCenter.GameSceneSystem.ActivedScene == null)
|
|||
|
return;
|
|||
|
|
|||
|
Character c = GameCenter.GameSceneSystem.FindEntity<Character>(result.objectId);
|
|||
|
if (c != null)
|
|||
|
{
|
|||
|
if (c.PropMoudle != null)
|
|||
|
c.PropMoudle.SetBattleProp(AllBattleProp.MoveSpeed, result.value);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var skillObj = GameCenter.GameSceneSystem.FindEntity<SkillObject>(result.objectId);
|
|||
|
if (skillObj != null)
|
|||
|
{
|
|||
|
skillObj.MoveSpeed = result.value / 100f;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//攻击速度改变
|
|||
|
public void GS2U_ResAttackspeedChange(MSG_Map.ResAttackspeedChange result)
|
|||
|
{
|
|||
|
if (GameCenter.GameSceneSystem.ActivedScene == null)
|
|||
|
return;
|
|||
|
|
|||
|
Character c = GameCenter.GameSceneSystem.ActivedScene.Find<Character>(result.objectId);
|
|||
|
if (c == null || c.PropMoudle == null)
|
|||
|
return;
|
|||
|
|
|||
|
c.PropMoudle.SetBattleProp(AllBattleProp.AttackSpeed, result.value);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResLineList(MSG_Map.ResLineList result)
|
|||
|
{
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_GET_MAP_LINES_RESULT, result.lines);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResPlayerCloakChange(MSG_Map.ResPlayerCloakChange result) { }
|
|||
|
public void GS2U_ResJumpBlock(MSG_Map.ResJumpBlock result)
|
|||
|
{
|
|||
|
NetHandler.OnResJumpBlock(result);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResBlockDoors(MSG_Map.ResBlockDoors result)
|
|||
|
{
|
|||
|
for (int i = 0; i < result.doors.Count; ++i)
|
|||
|
{
|
|||
|
GameCenter.DynamicBlockerManager.SetBlockerState(result.doors[i].id, result.doors[i].isopen);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResUpdateBlockDoor(MSG_Map.ResUpdateBlockDoor result)
|
|||
|
{
|
|||
|
GameCenter.DynamicBlockerManager.SetBlockerState(result.id, result.isopen);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResMagicBirth(MSG_Map.ResMagicBirth result)
|
|||
|
{
|
|||
|
//GameCenter.GameSceneSystem.RefreshSkillObject(new SkillObjectInitInfo(result.magic));
|
|||
|
}
|
|||
|
public void GS2U_ResMagicClean(MSG_Map.ResMagicClean result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.id);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResBonfireBirth(MSG_Map.ResBonfireBirth result)
|
|||
|
{
|
|||
|
//BonfireInfo info = new BonfireInfo(result.bonfire);
|
|||
|
//GameCenter.GameSceneSystem.RefreshBonFires(info);
|
|||
|
}
|
|||
|
public void GS2U_ResBonfireClean(MSG_Map.ResBonfireClean result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.id);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResUpdateCamp(MSG_Map.ResUpdateCamp result)
|
|||
|
{
|
|||
|
Character c = GameCenter.GameSceneSystem.FindEntity<Character>(result.id);
|
|||
|
if (c != null)
|
|||
|
{
|
|||
|
c.PropMoudle.SceneCampID = result.camp;
|
|||
|
if (c.IsLocalPlayer())
|
|||
|
{
|
|||
|
var playerList = GameCenter.GameSceneSystem.FindEntityAll<RemotePlayer>();
|
|||
|
for (int i = 0; playerList != null && i < playerList.Count; ++i)
|
|||
|
{
|
|||
|
playerList[i].UpdateNameColor();
|
|||
|
}
|
|||
|
if (GameCenter.MapLogicSwitch.GetSceneCampIcon(c as Player) > 0)
|
|||
|
{
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATE_HEADINFO, c);
|
|||
|
}
|
|||
|
var monsterList = GameCenter.GameSceneSystem.FindEntityAll<Monster>();
|
|||
|
for (int i = 0; monsterList != null && i < monsterList.Count; ++i)
|
|||
|
{
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATEHUDNAMECOLOR, monsterList[i].ID);
|
|||
|
}
|
|||
|
}
|
|||
|
else if (c is RemotePlayer)
|
|||
|
{
|
|||
|
var player = c as RemotePlayer;
|
|||
|
player.UpdateNameColor();
|
|||
|
|
|||
|
if (GameCenter.MapLogicSwitch.GetSceneCampIcon(c as Player) > 0)
|
|||
|
{
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATE_HEADINFO, player);
|
|||
|
}
|
|||
|
}
|
|||
|
else if(c is Monster)
|
|||
|
{
|
|||
|
if(c.IsShowHUD)
|
|||
|
{
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATEHUDNAMECOLOR, c.ID);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResMonsterPos(MSG_Map.ResMonsterPos result)
|
|||
|
{
|
|||
|
//GameCenter.MandateSystem.OnGetMonsterResult(new Vector2((float)result.x, (float)result.Y));
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResMonsterDieGetItem(MSG_Map.ResMonsterDieGetItem result)
|
|||
|
{
|
|||
|
if (GameCenter.GameSetting.IsEnabled(GameSettingKeyCode.TPDropEffect))
|
|||
|
return;
|
|||
|
var droper = GameCenter.GameSceneSystem.FindEntity<Character>(result.instanceId);
|
|||
|
var owner = GameCenter.GameSceneSystem.FindEntity<Character>(result.roleId);
|
|||
|
//如果掉落的怪物或者掉落的归属都找不到,不做展示
|
|||
|
if (droper == null || owner == null)
|
|||
|
return;
|
|||
|
|
|||
|
for(int index = 0; index < result.list.Count; ++index)
|
|||
|
{
|
|||
|
var msgItem = result.list[index];
|
|||
|
DeclareItem itemCfg = DeclareItem.Get(msgItem.itemId);
|
|||
|
long count = 1;
|
|||
|
if (itemCfg != null)
|
|||
|
{
|
|||
|
//主角的物品菜会展示
|
|||
|
if (owner.IsLocalPlayer())
|
|||
|
{
|
|||
|
if (itemCfg.DropItemNum > 0)
|
|||
|
{
|
|||
|
count = msgItem.num / itemCfg.DropItemNum;
|
|||
|
if (msgItem.num % itemCfg.DropItemNum != 0)
|
|||
|
{
|
|||
|
count += 1;
|
|||
|
}
|
|||
|
}
|
|||
|
if (itemCfg.Id == (int)ItemTypeCode.BindMoney)
|
|||
|
{
|
|||
|
//如果是绑定金币,走金币掉落流程
|
|||
|
var host = GameCenter.GameSceneSystem.FindEntity<Monster>(result.instanceId);
|
|||
|
if (host != null)
|
|||
|
{
|
|||
|
if (!host.IsXState(EntityStateID.Dead))
|
|||
|
{
|
|||
|
//没有死亡,添加金币数量,等待进入死亡状态后播放
|
|||
|
host.DropGoldCount = (int)count;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//当前已经在死亡状态,直接播放金币掉落效果
|
|||
|
for (int i = 0; i < count; ++i)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshDropGold(new DropGoldInitInfo(result.instanceId));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (owner.IsLocalPlayer() || itemCfg.Color >= (int)QualityCode.Golden)
|
|||
|
{
|
|||
|
//走物品掉落流程
|
|||
|
for (int i = 0; i < count; ++i)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshDropItem(new DropItemInitInfo(result.instanceId, result.roleId, msgItem.itemId));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (owner.IsLocalPlayer())
|
|||
|
{
|
|||
|
//走物品掉落流程
|
|||
|
for (int i = 0; i < count; ++i)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshDropItem(new DropItemInitInfo(result.instanceId, result.roleId, msgItem.itemId));
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//其他玩家只展示金色以上装备
|
|||
|
var equipCfg = DeclareEquip.Get(msgItem.itemId);
|
|||
|
if (equipCfg != null && equipCfg.Quality >= (int)QualityCode.Golden)
|
|||
|
{
|
|||
|
//走物品掉落流程
|
|||
|
for (int i = 0; i < count; ++i)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshDropItem(new DropItemInitInfo(result.instanceId, result.roleId, msgItem.itemId));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//弃用
|
|||
|
public void GS2U_ResMonsterDieGetCoin(MSG_Map.ResMonsterDieGetCoin result)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public void GS2U_ResPlayEffect(MSG_Map.ResPlayEffect result)
|
|||
|
{
|
|||
|
GameCenter.PushFixEvent((int)UIEventDefine.UI_SCREENEFFECT_FORM_OPEN, result.effectType);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResRoleStatue(MSG_Map.ResRoleStatue result)
|
|||
|
{
|
|||
|
//for (int i = 0; i < PlayerStatueInitInfo.StatueIds.Count; i++)
|
|||
|
//{
|
|||
|
// GameCenter.GameSceneSystem.RemoveRemoteEntity(PlayerStatueInitInfo.StatueIds[i]);
|
|||
|
//}
|
|||
|
//PlayerStatueInitInfo.StatueIds.Clear();
|
|||
|
//for (int i = 0; i < result.statues.Count; ++i)
|
|||
|
//{
|
|||
|
// var info = new PlayerStatueInitInfo(result.statues[i]);
|
|||
|
// GameCenter.GameSceneSystem.RefreshPlayerStatue(info);
|
|||
|
//}
|
|||
|
}
|
|||
|
public void GS2U_ResCityFlag(MSG_Map.ResCityFlag result)
|
|||
|
{
|
|||
|
//var info = new CityFlagInitInfo(result);
|
|||
|
//GameCenter.GameSceneSystem.RefreshCityFlag(info);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResUpdateMoveState(MSG_Map.ResUpdateMoveState result)
|
|||
|
{
|
|||
|
Monster m = GameCenter.GameSceneSystem.FindEntity<Monster>(result.id);
|
|||
|
if (m != null)
|
|||
|
{
|
|||
|
m.IsRunning = result.isRun;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResJumpTransport(MSG_Map.ResJumpTransport result)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResJumpDown(MSG_Map.ResJumpDown result)
|
|||
|
{
|
|||
|
NetHandler.OnResJumpDown(result);
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResPetHpChange(MSG_Map.ResPetHpChange result)
|
|||
|
{
|
|||
|
Pet pet = GameCenter.GameSceneSystem.FindEntity<Pet>(result.id);
|
|||
|
if (pet != null)
|
|||
|
{
|
|||
|
pet.PropMoudle.CurHP = result.curHp;
|
|||
|
pet.PropMoudle.SetBattleProp(AllBattleProp.MaxHP, (long)result.maxHp);
|
|||
|
pet.PropMoudle.SetBattleProp(AllBattleProp.MoveSpeed, result.speed);
|
|||
|
}
|
|||
|
}
|
|||
|
public void GS2U_ResMonsterDropMark(MSG_Map.ResMonsterDropMark result)
|
|||
|
{
|
|||
|
GameCenter.DropAscriptionSystem.UpdateMonsterDropOwners(result.monsterId, result.dropUserIds);
|
|||
|
}
|
|||
|
|
|||
|
//墓碑刷新
|
|||
|
public void GS2U_ResTombstoneBirth(MSG_Map.ResTombstoneBirth result)
|
|||
|
{
|
|||
|
//GameCenter.GameSceneSystem.RefreshTombstone(new TombstoneInitInfo(result.TombstoneInfo));
|
|||
|
}
|
|||
|
//清除墓碑
|
|||
|
public void GS2U_ResTombstoneClean(MSG_Map.ResTombstoneClean result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.id);
|
|||
|
}
|
|||
|
//刷新地面buff
|
|||
|
public void GS2U_ResGroundBuffBirth(MSG_Map.ResGroundBuffBirth result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RefreshGroundBuff(new GroundBuffInitInfo(result.groundBuffInfo));
|
|||
|
}
|
|||
|
//删除地面buff
|
|||
|
public void GS2U_ResGroundBuffClean(MSG_Map.ResGroundBuffClean result)
|
|||
|
{
|
|||
|
GameCenter.GameSceneSystem.RemoveRemoteEntity(result.gbid);
|
|||
|
}
|
|||
|
//地面产生效果
|
|||
|
public void GS2U_ResGroundBuffStar(MSG_Map.ResGroundBuffStar result)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResShowMonsterPop(MSG_Map.ResShowMonsterPop result)
|
|||
|
{
|
|||
|
var character = GameCenter.GameSceneSystem.FindEntity<Character>(result.monsterid);
|
|||
|
if (character != null)
|
|||
|
{
|
|||
|
character.ShowHUD();
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_SHOWEMONSTER_SERVERPOP, new object[] { character, result.talkid });
|
|||
|
}
|
|||
|
}
|
|||
|
//播放剧情
|
|||
|
public void GS2U_ResPlayCinematic(MSG_Map.ResPlayCinematic result)
|
|||
|
{
|
|||
|
//var cfg = DeclareCinematic.Get(result.cinematicID);
|
|||
|
//if (cfg != null)
|
|||
|
//{
|
|||
|
// GameCenter.CinematicSystem.Play(cfg, () =>
|
|||
|
// {
|
|||
|
// GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SERVER_CINEMATIC_START, cfg);
|
|||
|
// },
|
|||
|
// () =>
|
|||
|
// {
|
|||
|
// GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SERVER_CINEMATIC_END, cfg);
|
|||
|
// });
|
|||
|
//}
|
|||
|
}
|
|||
|
public void GS2U_ResNotCanGather(MSG_Map.ResNotCanGather result)
|
|||
|
{
|
|||
|
//GameCenter.SkyCitySystem.ResNotCanGather(result);
|
|||
|
}
|
|||
|
public void GS2U_ResShiHaiBroadcast(MSG_Map.ResShiHaiBroadcast result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>(result.playerId);
|
|||
|
if (player != null)
|
|||
|
{
|
|||
|
player.CurShiHaiID = result.shiHaiCfgId;
|
|||
|
}
|
|||
|
}
|
|||
|
public void GS2U_ResVipLvBroadCast(MSG_Map.ResVipLvBroadCast result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>((ulong)result.roleId);
|
|||
|
if (player != null)
|
|||
|
{
|
|||
|
player.VipLevel = result.vipLv;
|
|||
|
//保存vip等级
|
|||
|
CoreSDK.SDKCacheData.RoleVipLevel = player.VipLevel.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResGuildInfoBroadCast(MSG_Map.ResGuildInfoBroadCast result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>((ulong)result.roleId);
|
|||
|
if (player != null)
|
|||
|
{
|
|||
|
player.PropMoudle.GuildId = (ulong)result.guildId;
|
|||
|
player.PropMoudle.GuildName = result.guildName;
|
|||
|
player.PropMoudle.GuildRank = result.guildPos;
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATE_HEADINFO, player);
|
|||
|
if(result.guildId <= 0 && player.IsLocalPlayer())
|
|||
|
{
|
|||
|
var lp = player as LocalPlayer;
|
|||
|
if(lp.PkMode == PKMode.GuildMode)
|
|||
|
{
|
|||
|
//如果主角当前是公会PK模式,切换为和平
|
|||
|
MSG_Player.ReqUpdataPkState msg = new MSG_Player.ReqUpdataPkState();
|
|||
|
msg.pkState = 0;
|
|||
|
msg.Send();
|
|||
|
GameCenter.MsgPromptSystem.ShowPrompt(Thousandto.Cfg.Data.DeclareMessageString.Get(Thousandto.Cfg.Data.DeclareMessageString.C_PKMODE_AUTO_CHANGED_GUILD));
|
|||
|
}
|
|||
|
}
|
|||
|
if (player.IsLocalPlayer())
|
|||
|
{
|
|||
|
if(result.guildId > 0)
|
|||
|
{
|
|||
|
MSG_Guild.ReqGuildInfo msg = new MSG_Guild.ReqGuildInfo();
|
|||
|
msg.Send();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GameCenter.LuaSystem.Adaptor.OnExitGuildMsg();
|
|||
|
}
|
|||
|
|
|||
|
//刷新其他角色的名字颜色
|
|||
|
var playerList = GameCenter.GameSceneSystem.FindEntityAll<RemotePlayer>();
|
|||
|
for (int i = 0; playerList != null && i < playerList.Count; ++i)
|
|||
|
{
|
|||
|
playerList[i].UpdateNameColor();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//法宝信息改变
|
|||
|
public void GS2U_ResFabaoInfoBroadCast(MSG_Map.ResFabaoInfoBroadCast result)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
//灵体阶数改变
|
|||
|
public void GS2U_ResSpiritIdBroadCast(MSG_Map.ResSpiritIdBroadCast result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>((ulong)result.playerId);
|
|||
|
if(player != null)
|
|||
|
{
|
|||
|
//if(player.IsLocalPlayer())
|
|||
|
//{
|
|||
|
// var oldModel = RoleVEquipTool.GetLingTiBodyID((int)player.Occ, player.LingTiDegree);
|
|||
|
// var newModel = RoleVEquipTool.GetLingTiBodyID((int)player.Occ, result.spiritId);
|
|||
|
// if(oldModel != newModel)
|
|||
|
// {
|
|||
|
// GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_SHOWMODEL_VIEW, new int[4] { 3, newModel, 200, 0});
|
|||
|
// }
|
|||
|
//}
|
|||
|
player.LingTiDegree = result.spiritId;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//飞剑外形改变
|
|||
|
public void GS2U_ResHuaxinFlySwordBroadCast(MSG_Map.ResHuaxinFlySwordBroadCast result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>((ulong)result.playerId);
|
|||
|
if (player != null)
|
|||
|
{
|
|||
|
player.PropMoudle.FlySwordUID = (ulong)result.uid;
|
|||
|
player.PropMoudle.FlySwordCfgID = result.huxinFlyID;
|
|||
|
player.PropMoudle.FlySwordSkillId = result.feijianMaxID;
|
|||
|
player.LoadFlySword();
|
|||
|
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATE_HEADINFO, player);
|
|||
|
}
|
|||
|
}
|
|||
|
//仙娃外形改变
|
|||
|
public void GS2U_ResChildCallInfo(MSG_Map.ResChildCallInfo result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>((ulong)result.playerId);
|
|||
|
if (player != null)
|
|||
|
{
|
|||
|
if(result.opt == 0)
|
|||
|
{
|
|||
|
player.PropMoudle.MarryChildID = 0;
|
|||
|
player.PropMoudle.MarryChildName = null;
|
|||
|
player.UnLoadMarryChild();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
player.PropMoudle.MarryChildID = result.childId;
|
|||
|
player.PropMoudle.MarryChildName = result.childName;
|
|||
|
player.LoadMarryChild();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void GS2U_ResPlayerPlayVfx(MSG_Map.ResPlayerPlayVfx result)
|
|||
|
{
|
|||
|
var player = GameCenter.GameSceneSystem.FindEntity<Player>((ulong)result.playerId);
|
|||
|
if (player != null && player.Skin != null && GameObjectLimit.CanPlayVfx(player, ModelTypeCode.CollectionVFX))
|
|||
|
{
|
|||
|
player.Skin.PlayVFX(ModelTypeCode.CollectionVFX, result.vfxId, null, FSkinPartCode.Body, false, 1f, true, false, null, false, false);
|
|||
|
}
|
|||
|
}
|
|||
|
public void GS2U_ResSoulEquipChange(MSG_Map.ResSoulEquipChange result)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|