feat: add manager dialog npc.
This commit is contained in:
@@ -3729,6 +3729,39 @@ namespace BrewMonster
|
||||
public uint id_equipundestroy_service; // equipment undestroy service ID
|
||||
public uint id_goblin_skill_service; // goblin skill service ID
|
||||
public uint combined_services; // combined services mask
|
||||
// Simple service combination: each bit represents a parameterless service. Possible services include:
|
||||
// 0: Forget production skills
|
||||
// 1: Socket (drilling) service
|
||||
// 2: Empty (unused)
|
||||
// 3: Warehouse discovery service
|
||||
// 4: Guild service
|
||||
// 5: Pet fusion service
|
||||
// 6: Mail service
|
||||
// 7: Auction service
|
||||
// 8: Double EXP check-in service
|
||||
// 9: Pet egg division service
|
||||
// 10: Pet egg restoration service
|
||||
// 11: Territory war management service
|
||||
// 12: Leave battlefield service
|
||||
// 13: Point card exchange
|
||||
// 14: Equipment upgrade service
|
||||
// 15: Dyeing (coloring) service
|
||||
// 16: Spirit transformation service
|
||||
// 17: Sprite attribute reset
|
||||
// 18: Sprite skill reset
|
||||
// 19: Sprite forget skill
|
||||
// 20: Sprite refinement service
|
||||
// 21: Sprite separation service
|
||||
// 22: Sprite equipment dismantling
|
||||
// 23: Repair damaged equipment
|
||||
// 24: Trade platform service
|
||||
// 25: Demon conversion service
|
||||
// 26: Marriage-related service
|
||||
// 27: Base activation service
|
||||
// 28: Base upgrade and contribution
|
||||
// 29: Base material exchange
|
||||
// 30: View warehouse without password
|
||||
// 31: View inventory ranking list
|
||||
public uint id_mine; // mine ID
|
||||
public uint no_collision; // no collision with NPC
|
||||
public uint id_engrave_service; // engrave service ID
|
||||
@@ -3736,6 +3769,7 @@ namespace BrewMonster
|
||||
public uint combined_services2; // combined services mask 2
|
||||
public uint id_force_service; // force service ID
|
||||
public uint combined_switch; // combined switch, see NPC_COMBINED_SWITCH
|
||||
|
||||
}
|
||||
|
||||
public enum NPC_COMBINED_SWITCH
|
||||
|
||||
@@ -7,6 +7,8 @@ using UnityEngine;
|
||||
public class CECGameRun
|
||||
{
|
||||
private CECWorld m_pWorld;
|
||||
|
||||
protected CECUIManager m_pUIManager; // UI manager
|
||||
public CECWorld GetWorld() { return m_pWorld; }
|
||||
public bool StartGame(int idInst, Vector3 vHostPos)
|
||||
{
|
||||
@@ -22,4 +24,12 @@ public class CECGameRun
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
m_pUIManager = new CECUIManager();
|
||||
}
|
||||
|
||||
// Get UI manager
|
||||
public CECUIManager GetUIManager() { return m_pUIManager; }
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BrewMonster.Network
|
||||
BMLogger.LogError("CECGame::Init");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Initialize string tables
|
||||
InitializeStringTables();
|
||||
|
||||
@@ -126,6 +126,8 @@ namespace BrewMonster.Network
|
||||
{
|
||||
Debug.LogError($"[EC_Game] Error initializing string tables: {ex.Message}");
|
||||
}
|
||||
|
||||
m_pGameRun.Init();
|
||||
}
|
||||
|
||||
private struct ItemMsgMapEntry
|
||||
|
||||
@@ -58,4 +58,14 @@ public class CECNPCServer : CECNPC
|
||||
StartWork((int)WorkType.WT_NOTHING, (int)WorkID.WORK_STAND);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get way point ID bound with this NPC
|
||||
public uint? GetWayPointID()
|
||||
{
|
||||
uint? dwID = 0;
|
||||
if ((m_pDBEssence?.combined_services & 0x08) != 0)
|
||||
dwID = m_pDBEssence?.id_to_discover;
|
||||
|
||||
return dwID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1354,6 +1354,12 @@ namespace CSNetwork.S2CCommand
|
||||
{
|
||||
public int id;
|
||||
};
|
||||
|
||||
public struct cmd_sevnpc_serve
|
||||
{
|
||||
public int service_type;
|
||||
public uint len;
|
||||
};
|
||||
}
|
||||
|
||||
// Player and NPC state
|
||||
@@ -453,5 +453,15 @@ namespace CSNetwork.C2SCommand
|
||||
{
|
||||
return SerializeCommand(iCmd);
|
||||
}
|
||||
|
||||
public static Octets CreateNPCSevWaypointCmd(int serviceType, uint len)
|
||||
{
|
||||
var cmd = new cmd_sevnpc_serve
|
||||
{
|
||||
service_type = serviceType,
|
||||
len = len
|
||||
};
|
||||
return SerializeCommand(CommandID.SEVNPC_SERVE, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,6 +518,126 @@ namespace CSNetwork.GPDataType
|
||||
public const int PRAY_DISTANCE_CHANGE = 396; // Ò÷³ª¾àÀë²ÎÊý
|
||||
}
|
||||
|
||||
// NPC service type
|
||||
public static class NPC_service_type
|
||||
{
|
||||
public const int GP_NPCSEV_SELL = 1, // 1, NPC sell to player
|
||||
GP_NPCSEV_BUY = 2, // 2, NPC buy from player
|
||||
GP_NPCSEV_REPAIR = 3, // 3
|
||||
GP_NPCSEV_HEAL = 4, // 4
|
||||
GP_NPCSEV_TRANSMIT = 5, // 5, Transmit to somewhere
|
||||
|
||||
GP_NPCSEV_TASK_RETURN = 6, // 6, Return task
|
||||
GP_NPCSEV_TASK_ACCEPT = 7, // 7, Accept task
|
||||
GP_NPCSEV_TASK_MATTER = 8, // 8, Task matter
|
||||
GP_NPCSEV_LEARN = 9, // 9, Learn skill
|
||||
GP_NPCSEV_EMBED = 10, // 10, Embed stone
|
||||
|
||||
GP_NPCSEV_CLEAR_TESSERA = 11, // 11, Clear tessear
|
||||
GP_NPCSEV_MAKEITEM = 12, // 12
|
||||
GP_NPCSEV_BREAKITEM = 13, // 13
|
||||
GP_NPCSEV_TRASHPSW = 14, // 14, Change trash password
|
||||
GP_NPCSEV_OPENTRASH = 15, // 15, Open trash
|
||||
|
||||
GP_NPCSEV_RESERVED = 16, // 16
|
||||
GP_NPCSEV_IDENTIFY = 17, // 17, Identify item
|
||||
GP_NPCSEV_FACTION = 18, // 18, About faction
|
||||
GP_NPCSEV_BOOTHSELL = 19, // 19, Player booth sell
|
||||
GP_NPCSEV_TRAVEL = 20, // 20, Travel
|
||||
|
||||
GP_NPCSEV_BOOTHBUY = 21, // 21, Player booth buy
|
||||
GP_NPCSEV_WAYPOINT = 22, // 22
|
||||
GP_NPCSEV_FORGETSKILL = 23, // 23
|
||||
GP_NPCSEV_FACECHANGE = 24, // 24
|
||||
GP_NPCSEV_MAIL = 25, // 25
|
||||
|
||||
GP_NPCSEV_VENDUE = 26, // 26
|
||||
GP_NPCSEV_DBLEXPTIME = 27, // 27
|
||||
GP_NPCSEV_HATCHPET = 28, // 28
|
||||
GP_NPCSEV_RESTOREPET = 29, // 29
|
||||
GP_NPCSEV_BATTLE = 30, // 30
|
||||
|
||||
GP_NPCSEV_BUILDTOWER = 31, // 31
|
||||
GP_NPCSEV_LEAVEBATTLE = 32, // 32
|
||||
GP_NPCSEV_RETURNSTATUSPT = 33, // 33
|
||||
GP_NPCSEV_ACCOUNTPOINT = 34, // 34
|
||||
GP_NPCSEV_REFINE = 35, // 35
|
||||
|
||||
GP_NPCSEV_PETNAME = 36, // 36, change pet name
|
||||
GP_NPCSEV_PETSKILL_DEL = 37, // 37, Delete pet skill
|
||||
GP_NPCSEV_PETSKILL_LEARN = 38, // 38, Learn pet skill
|
||||
GP_NPCSEV_BIND_ITEM = 39, // 39, Bind item
|
||||
GP_NPCSEV_DESTROY_BIND = 40, // 40, Destroy bind item
|
||||
|
||||
CP_NPCSEV_CANCEL_DESTROY = 41, // 41, Cancel destroy bind item
|
||||
GP_NPCSEV_STOCK_TRANSACTION = 42,// 42
|
||||
GP_NPCSEV_STOCK_OPERATION = 43, // 43
|
||||
GP_NPCSEV_DYE = 44, // 44
|
||||
GP_NPCSEV_REFINE_TRANS = 45, // 45
|
||||
|
||||
GP_NPCSEV_COMPOSE = 46, // 46
|
||||
GP_NPCSEV_MAKE_SLOT = 47, // 47
|
||||
GP_NPCSEV_GOBLIN_RETURNSTATUSPT = 48, // 48, Return goblin status point
|
||||
GP_NPCSEV_GOBLIN_RETURNGENIUSPT = 49, // 49, Return goblin genius point
|
||||
GP_NPCSEV_GOBLINSKILL_LEARN = 50, // 50, Learn goblin skill
|
||||
|
||||
GP_NPCSEV_GOBLINSKILL_DEL = 51, // 51, delete goblin skill
|
||||
GP_NPCSEV_GOBLIN_REFINE = 52, // 52, Refine goblin
|
||||
GP_NPCSEV_GOBLIN_REFINETRANSFER = 53, // 53, Transfer refine level
|
||||
GP_NPCSEV_GOBLIN_DESTROY = 54, // 54, Destroy goblin
|
||||
GP_NPCSEV_GOBLINEQUIP_DESTROY = 55, // 55, Destroy goblin's equipment
|
||||
|
||||
GP_NPCSEV_DYE_BY_SUIT = 56, // 56, Dye by suit
|
||||
GP_NPCSEV_REPAIR_DESTROYING_ITEM = 57, // 57, Repair destroying item
|
||||
GP_NPCSEV_LEVELUP_PRODUCE = 58, // 58, Level up produce
|
||||
GP_NPCSEV_OPEN_ACCOUNT_BOX = 59, // 59, Open account box
|
||||
GP_NPCSEV_WEBTRADE = 60, // 60, Web trade
|
||||
|
||||
GP_NPCSEV_GODEVILCONVERT = 61, // 61, Convert between god and evil
|
||||
GP_NPCSEV_WEDDING_BOOK = 62, // 62
|
||||
GP_NPCSEV_WEDDING_INVITE = 63, // 63
|
||||
GP_NPCSEV_FACTION_FORTRESS_SERVICE_1 = 64, // 64
|
||||
GP_NPCSEV_FACTION_FORTRESS_SERVICE_2 = 65, // 65
|
||||
|
||||
GP_NPCSEV_FACTION_FORTRESS_SERVICE_3 = 66, // 66
|
||||
GP_NPCSEV_PET_DYE = 67, // 67
|
||||
GP_NPCSEV_VIEW_TRASHBOX = 68, // 68, check the trash box without password
|
||||
GP_NPCSEV_ENGRAVE = 69, // 69
|
||||
GP_NCPSEV_DPS_DPH_RANK = 70, // 70
|
||||
|
||||
GP_NPCSEV_ADDONREGEN = 71, // 71
|
||||
GP_NPCSEV_FORCE = 72, // 72
|
||||
GP_NPCSEV_TRANSMIT_DIRECT = 73, // 73
|
||||
GP_NPCSEV_PREVIEW_PRODUCE = 74, // 74
|
||||
GP_NPCSEV_COUNTRY_JOINLEAVE = 75,// 75
|
||||
|
||||
GP_NPCSEV_COUNTRY_LEAVEWAR = 76, // 76
|
||||
GP_NPCSEV_MARK = 77, // 77
|
||||
GP_NPCSEV_CROSSSERVER_GETIN = 78,// 78
|
||||
GP_NPCSEV_CROSSSERVER_GETOUT = 79,// 79
|
||||
|
||||
GP_NPCSEV_PLAYER_RENAME = 80, // 80
|
||||
GP_NPCSEV_STONE_TRANSFER = 81, // 81
|
||||
GP_NPCSEV_STONE_REPLACE = 82, // 82
|
||||
GP_NPCSEV_KINGSEV = 83, // 83
|
||||
GP_NPCSEV_SPLIT_FASHION = 84, // 84
|
||||
|
||||
GP_NPCSEV_OFFLINESHOP = 85, // 85
|
||||
GP_NPCSEV_REINCARNATION = 86, // 86
|
||||
GP_NPCSEV_GIFTCARD = 87, // 87
|
||||
|
||||
GP_NPCSEV_TRICKBATTLE = 88, // 88
|
||||
GP_NPCSEV_CARDRESPAWN = 89, // 89
|
||||
GP_NPCSEV_FLYSWORDIMPROVE = 90, // 90
|
||||
GP_NPCSEV_OPEN_FACTION_PVP = 91, // 91
|
||||
|
||||
GP_NPCSEV_ADVANCED_PRODUCE = 92, // 92
|
||||
GP_NPCSEV_GOLD_SHOP = 93, // 93
|
||||
GP_NPCSEV_DIVIDEND_GOLD_SHOP = 94, // 94
|
||||
GP_NPCSEV_PLAYER_CHANGE_GENDER = 95; // 95
|
||||
}
|
||||
|
||||
|
||||
// Constants used in moving control
|
||||
public struct MOVECONST
|
||||
{
|
||||
@@ -609,7 +729,7 @@ namespace CSNetwork.GPDataType
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_host_attacked
|
||||
public struct cmd_host_attacked
|
||||
{
|
||||
public int idAttacker;
|
||||
public int iDamage;
|
||||
@@ -772,19 +892,19 @@ namespace CSNetwork.GPDataType
|
||||
//TO DO: Check Valid
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_self_info_00
|
||||
public struct cmd_self_info_00
|
||||
{
|
||||
public short sLevel;
|
||||
public byte State;
|
||||
public byte Level2;
|
||||
public int iHP;
|
||||
public int iMaxHP;
|
||||
public int iMP;
|
||||
public int iMaxMP;
|
||||
public int iExp;
|
||||
public int iSP;
|
||||
public int iAP;
|
||||
public int iMaxAP;
|
||||
public short sLevel;
|
||||
public byte State;
|
||||
public byte Level2;
|
||||
public int iHP;
|
||||
public int iMaxHP;
|
||||
public int iMP;
|
||||
public int iMaxMP;
|
||||
public int iExp;
|
||||
public int iSP;
|
||||
public int iAP;
|
||||
public int iMaxAP;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
@@ -940,7 +1060,7 @@ namespace CSNetwork.GPDataType
|
||||
{
|
||||
public int cash_amount;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_unfreeze_ivtr_slot
|
||||
{
|
||||
@@ -993,8 +1113,8 @@ namespace CSNetwork.GPDataType
|
||||
public int expire_date;
|
||||
public uint amount;
|
||||
public uint slot_amount;
|
||||
public byte where;
|
||||
public byte index;
|
||||
public byte where;
|
||||
public byte index;
|
||||
};
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct cmd_pickup_item
|
||||
|
||||
@@ -612,6 +612,11 @@ namespace CSNetwork
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_NPCGREETING, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
}
|
||||
case CommandID.ACTIVATE_WAYPOINT:
|
||||
case CommandID.WAYPOINT_LIST:
|
||||
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_WAYPOINT, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,5 +953,12 @@ namespace CSNetwork
|
||||
m_idLastSelTarget = idTarget;
|
||||
}
|
||||
}
|
||||
|
||||
public void c2s_SendCmdNPCSevWaypoint()
|
||||
{
|
||||
gamedatasend gamedatasend = new gamedatasend();
|
||||
gamedatasend.Data = C2SCommandFactory.CreateNPCSevWaypointCmd(NPC_service_type.GP_NPCSEV_WAYPOINT, 0);
|
||||
SendProtocol(gamedatasend);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,6 +243,11 @@ namespace BrewMonster.Network
|
||||
Instance._gameSession.c2s_CmdSelectTarget(idTarget);
|
||||
}
|
||||
|
||||
public static void c2s_CmdNPCSevWaypoint()
|
||||
{
|
||||
Instance._gameSession.c2s_SendCmdNPCSevWaypoint();
|
||||
}
|
||||
|
||||
#region Task
|
||||
public static void c2s_CmdGetAllData(bool byPack, bool byEquip, bool byTask)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class CECGameUIMan
|
||||
{
|
||||
void PopupNPCDialog(NPC_ESSENCE pEssence)
|
||||
{
|
||||
m_pDlgNPC.PopupDialog(pEssence);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 450eac8e68388db418e23a6896c839c1
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class CECUIManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a73c9a2a2f66ce74d8141221c0f16e71
|
||||
+126
-61
@@ -5,23 +5,15 @@ using BrewMonster.Scripts;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using BrewMonster.Scripts.Player;
|
||||
using CSNetwork;
|
||||
using CSNetwork.Common;
|
||||
using CSNetwork.GPDataType;
|
||||
using CSNetwork.Protocols;
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
using NUnit.Framework;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using PerfectWorld.Scripts.Managers.BrewMonster.Managers;
|
||||
using PerfectWorld.Scripts.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Scene = UnityEngine.SceneManagement.Scene;
|
||||
@@ -65,6 +57,9 @@ public class CECHostPlayer : CECPlayer
|
||||
public GNDINFO m_GndInfo;
|
||||
int m_idUCSelTarget; // Uncertificately selected object's ID
|
||||
public float m_fVertSpeed = 0f;
|
||||
int m_idSevNPC = 0; // Current service NPC
|
||||
bool m_bTalkWithNPC = false; // true, is talking with NPC
|
||||
List<ushort> m_aWayPoints = new List<ushort>(); // Active way points
|
||||
|
||||
// ====== Ground cast config ======
|
||||
[Header("Ground Cast")]
|
||||
@@ -394,6 +389,7 @@ public class CECHostPlayer : CECPlayer
|
||||
case int value when value == EC_MsgDef.MSG_HST_HURTRESULT: OnMsgHstHurtResult(Msg); break;
|
||||
case int value when value == EC_MsgDef.MSG_HST_INFO00: OnMsgHstInfo00(Msg); break;
|
||||
case int value when value == EC_MsgDef.MSG_HST_NPCGREETING: OnMsgHstNPCGreeting(Msg); break;
|
||||
case int value when value == EC_MsgDef.MSG_HST_WAYPOINT: OnMsgHstWayPoint(Msg); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1796,69 +1792,138 @@ public class CECHostPlayer : CECPlayer
|
||||
{
|
||||
cmd_npc_greeting pCmd = GPDataTypeHelper.FromBytes<cmd_npc_greeting>((byte[])Msg.dwParam1);
|
||||
|
||||
//if (GPDataTypeHelper.ISNPCID(pCmd.idObject))
|
||||
//{
|
||||
// // רÃÅ´¦Àíѧϰ¼¼ÄܵÄÒþ²ØNPC
|
||||
// if (CECHostSkillModel::Instance().IsSkillLearnNPC(pCmd.idObject))
|
||||
// {
|
||||
// CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
// //m_idSevNPC = pCmd.idObject;
|
||||
// //m_bTalkWithNPC = true;
|
||||
// //pGameUI.GetDialog("Win_SkillAction").Show(true);
|
||||
// //CDlgSkillAction* dlg = dynamic_cast<CDlgSkillAction*>(pGameUI.GetDialog("Win_SkillAction"));
|
||||
// //dlg.ForceShowDialog();
|
||||
// CDlgSkillAction* dlg = dynamic_cast<CDlgSkillAction*>(pGameUI.GetDialog("Win_SkillAction"));
|
||||
// dlg.SetReceivedNPCGreeting(true);
|
||||
// return;
|
||||
// }
|
||||
if (GPDataTypeHelper.ISNPCID(pCmd.idObject))
|
||||
{
|
||||
// רÃÅ´¦Àíѧϰ¼¼ÄܵÄÒþ²ØNPC
|
||||
//if (CECHostSkillModel::Instance().IsSkillLearnNPC(pCmd.idObject))
|
||||
//{
|
||||
// CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
// //m_idSevNPC = pCmd.idObject;
|
||||
// //m_bTalkWithNPC = true;
|
||||
// //pGameUI.GetDialog("Win_SkillAction").Show(true);
|
||||
// //CDlgSkillAction* dlg = dynamic_cast<CDlgSkillAction*>(pGameUI.GetDialog("Win_SkillAction"));
|
||||
// //dlg.ForceShowDialog();
|
||||
// CDlgSkillAction* dlg = dynamic_cast<CDlgSkillAction*>(pGameUI.GetDialog("Win_SkillAction"));
|
||||
// dlg.SetReceivedNPCGreeting(true);
|
||||
// return;
|
||||
//}
|
||||
|
||||
// CECNPC* pNPC = g_pGame.GetGameRun().GetWorld().GetNPCMan().GetNPC(pCmd.idObject);
|
||||
// if (!pNPC || !pNPC.IsServerNPC())
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
CECNPC pNPC = EC_ManMessageMono.Instance._CECNPCMan.GetNPC(pCmd.idObject);
|
||||
if (!pNPC || !pNPC.IsServerNPC())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// // Check distance again
|
||||
// if (!CanTouchTarget(pNPC.GetPos(), pNPC.GetTouchRadius(), 3))
|
||||
// return;
|
||||
// Check distance again
|
||||
if (!CanTouchTarget(pNPC.GetPos(), pNPC.GetTouchRadius(), 3))
|
||||
return;
|
||||
|
||||
// m_idSevNPC = pCmd.idObject;
|
||||
// m_bTalkWithNPC = true;
|
||||
m_idSevNPC = pCmd.idObject;
|
||||
m_bTalkWithNPC = true;
|
||||
|
||||
// // Check way point service on NPC
|
||||
// DWORD dwID = ((CECNPCServer*)pNPC).GetWayPointID();
|
||||
// if (dwID && !HasWayPoint((WORD)dwID))
|
||||
// g_pGame.GetGameSession().c2s_CmdNPCSevWaypoint();
|
||||
// Check way point service on NPC
|
||||
var dwID = (pNPC as CECNPCServer).GetWayPointID();
|
||||
if (dwID != null && !HasWayPoint(dwID))
|
||||
UnityGameSession.c2s_CmdNPCSevWaypoint();
|
||||
//g_pGame.GetGameSession().c2s_CmdNPCSevWaypoint();
|
||||
|
||||
// CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
// pGameUI.PopupNPCDialog(((CECNPCServer*)pNPC).GetDBEssence());
|
||||
//}
|
||||
//else if (ISPLAYERID(pCmd.idObject))
|
||||
//{
|
||||
// CECElsePlayer* pPlayer = m_pPlayerMan.GetElsePlayer(pCmd.idObject);
|
||||
CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
pGameUI.PopupNPCDialog(((CECNPCServer*)pNPC).GetDBEssence());
|
||||
}
|
||||
else if (GPDataTypeHelper.ISPLAYERID(pCmd.idObject))
|
||||
{
|
||||
CECElsePlayer* pPlayer = m_pPlayerMan.GetElsePlayer(pCmd.idObject);
|
||||
|
||||
// // Check distance again
|
||||
// if (!pPlayer || !CanTouchTarget(pPlayer.GetPos(), 0.0f, 3))
|
||||
// return;
|
||||
// Check distance again
|
||||
if (!pPlayer || !CanTouchTarget(pPlayer.GetPos(), 0.0f, 3))
|
||||
return;
|
||||
|
||||
// m_idSevNPC = pCmd.idObject;
|
||||
// m_bTalkWithNPC = true;
|
||||
// m_iBoothState = 3;
|
||||
m_idSevNPC = pCmd.idObject;
|
||||
m_bTalkWithNPC = true;
|
||||
m_iBoothState = 3;
|
||||
|
||||
// g_pGame.GetGameSession().c2s_CmdNPCSevGetContent(GP_NPCSEV_BOOTHSELL);
|
||||
g_pGame.GetGameSession().c2s_CmdNPCSevGetContent(GP_NPCSEV_BOOTHSELL);
|
||||
|
||||
// m_pBuyPack.RemoveAllItems();
|
||||
// m_pSellPack.RemoveAllItems();
|
||||
// m_pEPBoothBPack.RemoveAllItems();
|
||||
// m_pEPBoothSPack.RemoveAllItems();
|
||||
m_pBuyPack.RemoveAllItems();
|
||||
m_pSellPack.RemoveAllItems();
|
||||
m_pEPBoothBPack.RemoveAllItems();
|
||||
m_pEPBoothSPack.RemoveAllItems();
|
||||
|
||||
// CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
// pGameUI.PopupBoothDialog(true, false, pCmd.idObject);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
CECGameUIMan* pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
pGameUI.PopupBoothDialog(true, false, pCmd.idObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Does host player have specified way point ?
|
||||
bool HasWayPoint(uint? wID)
|
||||
{
|
||||
if (wID == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < m_aWayPoints.Count; i++)
|
||||
{
|
||||
if (m_aWayPoints[i] == wID)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnMsgHstWayPoint(ECMSG Msg)
|
||||
{
|
||||
CECGameUIMan pGameUI = g_pGame.GetGameRun().GetUIManager().GetInGameUIMan();
|
||||
|
||||
if (Convert.ToInt32(Msg.dwParam2) == CommandID.ACTIVATE_WAYPOINT)
|
||||
{
|
||||
cmd_activate_waypoint* pCmd = (cmd_activate_waypoint*)Msg.dwParam1;
|
||||
m_aWayPoints.Add(pCmd.waypoint);
|
||||
|
||||
// add to waypoints array
|
||||
pGameUI.GetMapDlgsMgr().UpdateWayPoints(&pCmd.waypoint, 1, false);
|
||||
|
||||
// Print a notify message
|
||||
const CECMapDlgsMgr::PointMap& aWayPoints = pGameUI.GetMapDlgsMgr().GetTransPoint();
|
||||
CECMapDlgsMgr::PointMap::const_iterator itr = aWayPoints.find(pCmd.waypoint);
|
||||
if(itr != aWayPoints.end())
|
||||
{
|
||||
g_pGame.GetGameRun().AddFixedMessage(FIXMSG_NEWWAYPOINT, (itr.second).strName);
|
||||
|
||||
bool bCanPopUITips = true;
|
||||
int count = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITipsCount();
|
||||
// ¼ì²éÉíÉÏÊÇ·ñÓнûÖ¹µ¯³ötipsµÄÈÎÎñ
|
||||
for (int i=0;i<count;i++){
|
||||
int taskID = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITips(i);
|
||||
if(GetTaskInterface() && GetTaskInterface().HasTask(taskID)){
|
||||
bCanPopUITips = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// µ¯³ötips
|
||||
CECScriptMan* pScriptMan = g_pGame.GetGameRun().GetUIManager().GetScriptMan();
|
||||
if (pScriptMan && bCanPopUITips)
|
||||
{
|
||||
pScriptMan.GetContext().GetUI().SetTipDialogTitleAndContent(AC2AS_CP(CP_UTF8, pGameUI.GetStringFromTable(11350)), AC2AS_CP(CP_UTF8, (itr.second).strName));
|
||||
pScriptMan.GetContext().GetUI().ShowTip(500, 500, 5000, 300);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (Msg.dwParam2 == WAYPOINT_LIST)
|
||||
{
|
||||
cmd_waypoint_list* pCmd = (cmd_waypoint_list*)Msg.dwParam1;
|
||||
|
||||
m_aWayPoints.SetSize(pCmd.count, 16);
|
||||
for (size_t i = 0; i < pCmd.count; i++)
|
||||
m_aWayPoints[i] = pCmd.list[i];
|
||||
|
||||
// update the whole list
|
||||
pGameUI.GetMapDlgsMgr().UpdateWayPoints(pCmd.list, pCmd.count, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
|
||||
[SerializeField] private HUDNPC npsUI;
|
||||
|
||||
CECGameUIMan gameUI;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
@@ -96,4 +98,14 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
kv.Value.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
// If current UI manager is INGAME manager, this function return it's interface
|
||||
public CECGameUIMan GetInGameUIMan()
|
||||
{
|
||||
if(gameUI == null)
|
||||
{
|
||||
gameUI = new CECGameUIMan();
|
||||
}
|
||||
return gameUI;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user