コード例 #1
0
        public static void CreatePlayerImage(CSCommon.MapInfo_Npc nd, MapInstance map, ulong playerId)
        {
            PlayerImage ret = new PlayerImage();

            ret.mId = ServerFrame.Util.GenerateObjID(ServerFrame.GameObjectType.PlayerImage);

            RPC.PackageWriter pkg = new RPC.PackageWriter();
            H_RPCRoot.smInstance.HGet_ComServer(pkg).HGet_UserRoleManager(pkg).RPC_GetOffPlayerData(pkg, playerId);
            pkg.WaitDoCommand(IPlanesServer.Instance.ComConnect, RPC.CommandTargetType.DefaultType, new System.Diagnostics.StackTrace(1, true)).OnFarCallFinished = delegate(RPC.PackageProxy _io, bool bTimeOut)
            {
                CSCommon.Data.RoleCom rc = new CSCommon.Data.RoleCom();
                _io.Read(rc);
                OffPlayerData pd = new OffPlayerData();
                pd.Deserizle(rc);

                ret.InitPlayerData(pd, rc);

                var init = new NpcInit();
                init.GameType     = eActorGameType.PlayerImage;
                init.Data         = nd;
                init.OwnerMapData = map.MapInfo;
                if (!ret.Initialize(init))
                {
                    return;
                }

                ret.mAttackTarget = playerId;
                ret.Reborn();
                ret.OnEnterMap(map);
            };
        }
コード例 #2
0
        public MoveNodes <int> mPathNodes = new MoveNodes <int>(); //镖车行走路线

        public static NPCInstance CreateNPCInstance(CSCommon.MapInfo_Npc nd, MapInstance map)
        {
            NPCInstance ret = new NPCInstance();

            ret.mId = ServerFrame.Util.GenerateObjID(ServerFrame.GameObjectType.NPC);

            var init = new NpcInit();

            init.GameType     = eActorGameType.Npc;
            init.Data         = nd;
            init.OwnerMapData = map.MapInfo;
            if (!ret.Initialize(init))
            {
                return(null);
            }

            ret.Reborn();
            ret.OnEnterMap(map);

            return(ret);
        }