コード例 #1
0
ファイル: RoleMgr.cs プロジェクト: xyzsangxuan/RPGFramework
    internal static void OnMainRoleThisid(Cmd cmd)
    {
        if (!Net.CheckCmd(cmd, typeof(MainRoleThisIdCmd)))
        {
            return;
        }
        MainRoleThisIdCmd thisIdCmd = cmd as MainRoleThisIdCmd;

        RoleMgr.instance._mainRoleThisId = thisIdCmd.thisId;
    }
コード例 #2
0
    internal static void OnSelectRole(Cmd cmd)
    {
        if (!Net.CheckCmd(cmd, typeof(SelectRoleCmd)))
        {
            return;
        }
        SelectRoleCmd selectRoleCmd = cmd as SelectRoleCmd;

        var curPlayer = Server.instance.curPlayer;

        var curRole = Server.instance.curPlayer.allRole[selectRoleCmd.index];

        curPlayer.curRole = curRole;
        var roleTableData = RoleTable.instance[curRole.modelId];

        curRole.name    = roleTableData.name;
        curRole.hp      = roleTableData.hp;
        curRole.attack  = roleTableData.attack;
        curRole.defence = roleTableData.defence;

        //告诉客户端,场景编号
        //分配ThisId
        var thisId = RoleServer.getNewThisId();

        curPlayer.curRole.thisID = thisId;
        //告诉客户端主角的Thisid
        MainRoleThisIdCmd thisIdCmd = new MainRoleThisIdCmd()
        {
            thisId = thisId
        };

        Server.instance.SendCmd(thisIdCmd);

        //进入场景(原来的函数是没有MapId,或许这部分的代码应该另写)
        EnterMap(curRole, 1);
    }