Merge branch 'develop' of https://git.pthub.vn/Unity/perfect-world-unity into fix-ui
This commit is contained in:
@@ -0,0 +1,259 @@
|
||||
using BrewMonster.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts;
|
||||
using BrewMonster.UI;
|
||||
using CSNetwork.GPDataType;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using UnityEngine;
|
||||
using static BrewMonster.Scripts.CECHPWork;
|
||||
using static BrewMonster.CECHPWorkTrace;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public partial class CECHostPlayer
|
||||
{
|
||||
public bool GetWalkRunFlag() => m_bWalkRun;
|
||||
public bool GetRushFlyFlag() => m_bRushFly;
|
||||
|
||||
CECCounter m_BindCmdCoolCnt = new CECCounter();
|
||||
|
||||
public CECCounter GetBindCmdCoolCnt() => m_BindCmdCoolCnt;
|
||||
|
||||
void InitBindCmdCoolCnt()
|
||||
{
|
||||
m_BindCmdCoolCnt.SetPeriod(35000);
|
||||
m_BindCmdCoolCnt.Reset(true);
|
||||
}
|
||||
|
||||
// Sit down / Stand up
|
||||
// 坐下 / 站起
|
||||
public bool CmdSitDown(bool bSitDown)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: CmdSitDown:"+bSitDown);
|
||||
if (!CanDo(ActionCanDo.CANDO_SITDOWN))
|
||||
return false;
|
||||
|
||||
if (bSitDown)
|
||||
UnityGameSession.c2s_CmdSitDown();
|
||||
else
|
||||
UnityGameSession.c2s_CmdStandUp();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Switch walk and run state
|
||||
// 切换走/跑状态
|
||||
public bool CmdWalkRun(bool bRun)
|
||||
{
|
||||
m_bWalkRun = bRun;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find a near target (stub)
|
||||
// 寻找附近目标(占位)
|
||||
public bool CmdFindTarget()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Select other player's attacked target
|
||||
// 选择队友正在攻击的目标
|
||||
public bool CmdAssistAttack()
|
||||
{
|
||||
if (m_pWorkMan.IsSitting())
|
||||
{
|
||||
UnityGameSession.c2s_CmdStandUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CanDo(ActionCanDo.CANDO_ASSISTSEL))
|
||||
UnityGameSession.c2s_CmdTeamAssistSel(m_idSelTarget);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Invite selected player to join team
|
||||
// 邀请选中的玩家入队
|
||||
public bool CmdInviteToTeam()
|
||||
{
|
||||
if (IsDead() || !GPDataTypeHelper.ISPLAYERID(m_idSelTarget) || m_idSelTarget == GetCharacterID())
|
||||
return false;
|
||||
|
||||
UnityGameSession.c2s_CmdTeamInvite(m_idSelTarget);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Leave current team (confirmation dialog)
|
||||
// 离开当前队伍(确认框)
|
||||
public bool CmdLeaveTeam()
|
||||
{
|
||||
if (IsDead() || m_pTeam == null)
|
||||
return false;
|
||||
|
||||
string szMsg = CECUIManager.Instance?.GetInGameUIMan()?.GetStringFromTable(235)
|
||||
?? "Are you sure you want to leave the team?";
|
||||
CECUIManager.Instance?.ShowMessageBoxYesAndNo("", szMsg, null,
|
||||
() => UnityGameSession.c2s_CmdTeamLeaveParty(), null);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Kick one member of team (stub)
|
||||
// 踢出队员(占位)
|
||||
public bool CmdKickTeamMember()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Search for a team (stub)
|
||||
// 寻找队伍(占位)
|
||||
public bool CmdFindTeam()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Start trade with other selected player
|
||||
// 与选中玩家开始交易
|
||||
public bool CmdStartTrade()
|
||||
{
|
||||
if (m_pWorkMan.IsSitting())
|
||||
{
|
||||
UnityGameSession.c2s_CmdStandUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CanDo(ActionCanDo.CANDO_TRADE))
|
||||
return false;
|
||||
|
||||
if (!GPDataTypeHelper.ISPLAYERID(m_idSelTarget) || m_idSelTarget == m_PlayerInfo.cid)
|
||||
return false;
|
||||
|
||||
UnityGameSession.trade_Start(m_idSelTarget);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Open booth for selling items
|
||||
// 开摊出售
|
||||
public bool CmdSellBooth()
|
||||
{
|
||||
if (IsInvisible())
|
||||
{
|
||||
CECGameRun.Instance?.AddFixedMessage((int)FixedMsg.FIXMSG_CANNOT_USE_WHEN_INVISIBLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_pWorkMan.IsSitting())
|
||||
{
|
||||
UnityGameSession.c2s_CmdStandUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_pWorkMan.IsFollowing())
|
||||
m_pWorkMan.FinishAllWork(true);
|
||||
|
||||
if (!CanDo(ActionCanDo.CANDO_BOOTH))
|
||||
return false;
|
||||
|
||||
UnityGameSession.c2s_CmdOpenBoothTest();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Open booth for buying items (stub)
|
||||
// 开摊收购(占位)
|
||||
public bool CmdBuyBooth()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Invite selected player to join faction (stub)
|
||||
// 邀请入帮(占位)
|
||||
public bool CmdInviteToFaction()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*public bool CmdPickup()
|
||||
{
|
||||
if (m_pWorkMan.IsSitting())
|
||||
{
|
||||
UnityGameSession.c2s_CmdStandUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CanDo(ActionCanDo.CANDO_PICKUP))
|
||||
return false;
|
||||
|
||||
CECHPWork pWork = m_pWorkMan.GetWork(Host_work_ID.WORK_TRACEOBJECT);
|
||||
if (pWork is CECHPWorkTrace pTrace &&
|
||||
pTrace.GetTraceReason() == Trace_reason.TRACE_PICKUP)
|
||||
return true;
|
||||
|
||||
EC_ManMatter matterMan = EC_ManMessageMono.Instance?.EC_ManMatter;
|
||||
CECMatter pMatter = matterMan?.FindMatterNearHost(10.0f, true);
|
||||
if (pMatter != null)
|
||||
PickupObject(pMatter.GetMatterID(), false);
|
||||
|
||||
return true;
|
||||
}*/
|
||||
|
||||
public bool CmdGather()
|
||||
{
|
||||
if (m_pWorkMan.IsSitting())
|
||||
{
|
||||
UnityGameSession.c2s_CmdStandUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CanDo(ActionCanDo.CANDO_GATHER))
|
||||
return false;
|
||||
|
||||
CECHPWork pWork = m_pWorkMan.GetWork(Host_work_ID.WORK_TRACEOBJECT);
|
||||
if (pWork is CECHPWorkTrace pTrace &&
|
||||
pTrace.GetTraceReason() == Trace_reason.TRACE_GATHER)
|
||||
return true;
|
||||
|
||||
PickupObject(m_idSelTarget, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CmdRushFly()
|
||||
{
|
||||
if (m_bAboutToDie || IsDead() || !IsFlying())
|
||||
return false;
|
||||
|
||||
UnityGameSession.c2s_CmdActiveRushFly(!m_bRushFly);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CmdBindBuddy(int idTarget)
|
||||
{
|
||||
if (!m_BindCmdCoolCnt.IsFull())
|
||||
{
|
||||
CECGameRun.Instance?.AddFixedMessage((int)FixedMsg.FIXMSG_CMD_INCOOLTIME);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CanDo(ActionCanDo.CANDO_BINDBUDDY) || !GPDataTypeHelper.ISPLAYERID(idTarget) ||
|
||||
idTarget == GetCharacterID())
|
||||
return false;
|
||||
|
||||
EC_ElsePlayer pPlayer = m_pPlayerMan?.GetElsePlayer(idTarget);
|
||||
if (pPlayer == null || pPlayer.GetGender() == GetGender())
|
||||
return false;
|
||||
|
||||
A3DVECTOR3 vDist = pPlayer.GetServerPos() - GetPos();
|
||||
if (vDist.Magnitude() >= 2.8f)
|
||||
{
|
||||
CECGameRun.Instance?.AddFixedMessage((int)FixedMsg.FIXMSG_TARGETISFAR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetGender() == GENDER.GENDER_MALE)
|
||||
UnityGameSession.c2s_CmdBindPlayerInvite(idTarget);
|
||||
else
|
||||
UnityGameSession.c2s_CmdBindPlayerRequest(idTarget);
|
||||
|
||||
m_BindCmdCoolCnt.Reset();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61bcfdcbd8ffcd746b0e59990cc6970b
|
||||
@@ -135,6 +135,7 @@ namespace BrewMonster
|
||||
int iAction = (int)PLAYER_ACTION_TYPE.ACT_STAND;
|
||||
bool bSession = false;
|
||||
|
||||
BMLogger.LogError("HoangDev: idEmote "+idEmote);
|
||||
// Select action according to pose
|
||||
switch (idEmote)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts;
|
||||
using BrewMonster.Scripts.Task;
|
||||
using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public partial class CECHostPlayer
|
||||
{
|
||||
private void OnMsgPlayerSitDown(ECMSG Msg)
|
||||
{
|
||||
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_SIT_DOWN)
|
||||
{
|
||||
if (m_pWorkMan.IsMovingToPosition() ||
|
||||
m_pWorkMan.IsTracing() ||
|
||||
m_pWorkMan.IsFollowing())
|
||||
{
|
||||
m_MoveCtrl.SendStopMoveCmd(EC_Utility.ToVector3(GetPos()), GetGroundSpeed(), (int)GPMoveMode.GP_MOVE_RUN);
|
||||
}
|
||||
|
||||
m_dwStates |= (uint)PlayerNPCState.GP_STATE_SITDOWN;
|
||||
CECHPWorkSit pWork = (CECHPWorkSit)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_SIT);
|
||||
pWork.SetBeSittingFlag(false);
|
||||
m_pWorkMan.StartWork_p1(pWork);
|
||||
|
||||
GetTaskInterface().SetEmotion((int)TaskInterface.CommandTaskAction.CMD_EMOTION_SITDOWN);
|
||||
}
|
||||
else if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_STAND_UP)
|
||||
{
|
||||
m_dwStates &= ~(uint)PlayerNPCState.GP_STATE_SITDOWN;
|
||||
CECHPWorkStand pWork = (CECHPWorkStand)m_pWorkMan.CreateWork(CECHPWork.Host_work_ID.WORK_STAND);
|
||||
m_pWorkMan.StartWork_p1(pWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b8afadf7e5c78f409d4e8746ef6ea77
|
||||
@@ -565,6 +565,7 @@ namespace BrewMonster
|
||||
case EC_MsgDef.MSG_HST_COOLTIMEDATA: OnMsgHstCoolTimeData(Msg); break;
|
||||
case EC_MsgDef.MSG_HST_PRESSCANCEL: OnMsgHstPressCancel(Msg); break;
|
||||
case EC_MsgDef.MSG_PM_PLAYERFLY: OnMsgPlayerFly(Msg); break;
|
||||
case EC_MsgDef.MSG_PM_PLAYERSITDOWN: OnMsgPlayerSitDown(Msg); break;
|
||||
case EC_MsgDef.MSG_HST_PETOPT: OnMsgHstPetOpt(Msg); break;
|
||||
case EC_MsgDef.MSG_HST_SETPLAYERLIMIT: OnMsgHstSetPlayerLimit(Msg); break;
|
||||
case EC_MsgDef.MSG_PM_PLAYERMOUNT: OnMsgPlayerMount(Msg); break;
|
||||
@@ -1327,6 +1328,7 @@ namespace BrewMonster
|
||||
m_IncantCnt = new CECCounter();
|
||||
m_IncantCnt.SetPeriod(1000);
|
||||
m_IncantCnt.Reset(true);
|
||||
InitBindCmdCoolCnt();
|
||||
m_bEnterGame = false;
|
||||
}
|
||||
|
||||
@@ -3374,7 +3376,8 @@ namespace BrewMonster
|
||||
|
||||
if (iPose == (int)RoleExpression.ROLEEXP_SITDOWN)
|
||||
{
|
||||
// UnityGameSession.c2s_CmdSessionEmote(iPose);
|
||||
BMLogger.LogError("HoangDev: c2s_CmdSessionEmote: "+iPose);
|
||||
UnityGameSession.c2s_CmdSessionEmote(iPose);
|
||||
}
|
||||
else if (iPose == (int)RoleExpression.ROLEEXP_KISS)
|
||||
{
|
||||
@@ -3655,9 +3658,10 @@ namespace BrewMonster
|
||||
|
||||
m_PetOptCnt.IncCounter(iRealTime);
|
||||
// Bind command cool counter
|
||||
/* if (m_BindCmdCoolCnt.IncCounter(dwDeltaTime))
|
||||
m_BindCmdCoolCnt.Reset(true);
|
||||
if (m_BindCmdCoolCnt.IncCounter(iRealTime))
|
||||
m_BindCmdCoolCnt.Reset(true);
|
||||
|
||||
/*
|
||||
// Auto fashion time counter
|
||||
if (m_bAutoFashion && GetBoothState() != 2 && !IsShapeChanged())
|
||||
{
|
||||
|
||||
@@ -222,6 +222,7 @@ namespace BrewMonster
|
||||
{
|
||||
return;
|
||||
}
|
||||
BMLogger.LogError("HoangDev animationName:"+animationName);
|
||||
bool isState = namedAnimancer.States.TryGet(animationName, out var existingState) ? true : false;
|
||||
if (isState)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user