protected override void OnDestroyManager()
        {
            var em         = MainWorld.GetOrCreateManager <EntityManager>();
            var gpSystem   = MainWorld.GetOrCreateManager <GamePlayerSystem>();
            var allPlayers = gpSystem.SlowGetAllPlayers();

            for (int i = 0; i != allPlayers.Length; i++)
            {
                var entity = allPlayers.Entities[i];
                if (!em.HasComponent <PlayerPeerLink>(entity))
                {
                    continue;
                }

                var plLink = em.GetSharedComponentData <PlayerPeerLink>(entity);

                if (plLink.Owner != NetInstance.PeerInstance)
                {
                    continue;
                }

                em.RemoveComponent <PlayerPeerLink>(entity);

                if (em.HasComponent <PlayerUserLink>(entity))
                {
                    em.RemoveComponent <PlayerUserLink>(entity);
                }
                if (em.HasComponent <ConnectedPlayerEntity>(entity))
                {
                    em.RemoveComponent <ConnectedPlayerEntity>(entity);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Проверка блока на возможность упасть
        /// </summary>
        /// <returns><c>true</c> если может упасть. <code>false</code> при невозможности упасть</returns>
        public bool CanFall()
        {
            TypeBlocks SideBlock;

            if (Y <= 0)
            {
                fall = false;
                return(false);
            }

            SideBlock = MainWorld.GetTypeBlockMap(X - 1, Y);
            if (SideBlock == TypeBlocks.Plant || SideBlock == TypeBlocks.Seed || SideBlock == TypeBlocks.Earth)
            {
                return(false);
            }
            SideBlock = MainWorld.GetTypeBlockMap(X + 1, Y);
            if (SideBlock == TypeBlocks.Plant || SideBlock == TypeBlocks.Seed || SideBlock == TypeBlocks.Earth)
            {
                return(false);
            }
            SideBlock = MainWorld.GetTypeBlockMap(X, Y - 1);
            if (SideBlock == TypeBlocks.Plant || SideBlock == TypeBlocks.Seed || SideBlock == TypeBlocks.Earth)
            {
                return(false);
            }

            /*SideBlock = MainWorld.GetTypeBlockMap(X, Y + 1);
             * if (SideBlock == TypeBlocks.Plant || SideBlock == TypeBlocks.Seed || SideBlock == TypeBlocks.Earth)
             * {
             *  return false;
             * }*/

            fall = true;
            return(true);
        }
    //Make this single
    private void Awake()
    {
        Instance = this;

        //初始化
        Initialize();
    }
示例#4
0
        public virtual void SaveToXML(XmlElement objOrbit)
        {
            var nfi = System.Globalization.NumberFormatInfo.InvariantInfo;

            var xePlanet = objOrbit.OwnerDocument.CreateElement("Planet");

            objOrbit.AppendChild(xePlanet);
            Common.CreateTextNode(xePlanet, "Type", PlanetType.ToString());
            Common.CreateTextNode(xePlanet, "Dense", Dense.ToString());
            Common.CreateTextNode(xePlanet, "Mass", Mass.ToString());
            Common.CreateTextNode(xePlanet, "Gravity", Grav.ToString());
            Common.CreateTextNode(xePlanet, "Pressure", Pressure.ToString());
            Common.CreateTextNode(xePlanet, "MaxPop", Maxpop.ToString());
            Common.CreateTextNode(xePlanet, "OrbitRange", OrbitRange.ToString());
            Common.CreateTextNode(xePlanet, "OrbitNumber", OrbitNumber.ToString());
            Common.CreateTextNode(xePlanet, "Tilt", Tilt.ToString());
            Common.CreateTextNode(xePlanet, "Ecc", Ecc.ToString());
            Common.CreateTextNode(xePlanet, "Rotation", Rotation.ToString());
            Common.CreateTextNode(xePlanet, "TidallyLocked", TidallyLocked.ToString());
            Common.CreateTextNode(xePlanet, "Temp", Temp.ToString());
            Common.CreateTextNode(xePlanet, "Diameter", Diameter.ToString());
            Common.CreateTextNode(xePlanet, "NumSats", Satellites.Count.ToString());
            Common.CreateTextNode(xePlanet, "Mainworld", MainWorld.ToString());
            Common.CreateTextNode(xePlanet, "NormalUWP", Normal.DisplayString(PlanetType, Diameter));
            Common.CreateTextNode(xePlanet, "CollapseUWP", Collapse.DisplayString(PlanetType, Diameter));
            Common.CreateTextNode(xePlanet, "Life", Life.ToString());
            Common.CreateTextNode(xePlanet, "LifeFactor", LifeFactor.ToString());
            Common.CreateTextNode(xePlanet, "Name", Name);

            var xeChild = objOrbit.OwnerDocument.CreateElement("Temperature");

            for (var i = 0; i < (Constants.NUM_HEX_ROWS * 2) - 1; i += 2)
            {
                var xeTemp = objOrbit.OwnerDocument.CreateElement("Row" + (i / 2 + 1).ToString());

                Common.CreateTextNode(xeTemp, "Summer", Summer[i].ToString("N", nfi) + "/" + Summer[i + 1].ToString("N", nfi));
                Common.CreateTextNode(xeTemp, "Fall", Fall[i].ToString("N", nfi) + "/" + Fall[i + 1].ToString("N", nfi));
                Common.CreateTextNode(xeTemp, "Winter", Winter[i].ToString("N", nfi) + "/" + Winter[i + 1].ToString("N", nfi));

                xeChild.AppendChild(xeTemp);
            }

            xePlanet.AppendChild(xeChild);

            if (Life)
            {
                xeChild = objOrbit.OwnerDocument.CreateElement("AnimalEncounters");
                TableGenerator.WriteToXML(xeChild);
                xePlanet.AppendChild(xeChild);
            }

            Normal.SaveToXML(xePlanet);
            Collapse.SaveToXML(xePlanet);

            foreach (var satellite in Satellites)
            {
                satellite.SaveToXML(xePlanet);
            }
        }
示例#5
0
 public UpdateCubePositionSystem(MainWorld world)
 {
     mainWorld = world;
     testGroup = mainWorld.CreateGroup(GroupType.All, new HashSet <Type>
     {
         typeof(GameObjectComponent)
     });
 }
示例#6
0
        public Vector3 ComputeCollision(Vector3 absTranslation)  // Takes the wanted translation and returns the possible one
        {
            bool wasHCollision = this.WasHorizontalCollision;

            this.WasHorizontalCollision = false;
            absTranslation.x            = MathHelper.clamp(absTranslation.x, -Cst.CUBE_SIDE, Cst.CUBE_SIDE);
            absTranslation.y            = MathHelper.clamp(absTranslation.y, -Cst.CUBE_SIDE, Cst.CUBE_SIDE);
            absTranslation.z            = MathHelper.clamp(absTranslation.z, -Cst.CUBE_SIDE, Cst.CUBE_SIDE);

            Vector3[] hitPoints      = this.GetHitPoints();
            Vector3   actTranslation = absTranslation;

            Vector3[] axes = new Vector3[] { Vector3.UNIT_X, Vector3.UNIT_Y, Vector3.UNIT_Z };

            foreach (Vector3 axis in axes)
            {
                Vector3 delta = absTranslation * axis;
                if (delta.IsZeroLength)
                {
                    continue;
                }                                                            // Ignore the axis if there is no translation on it

                Vector3[] actHitPoints    = this.AddToAll(hitPoints, delta); // The hitPoints after the wanted translation
                Vector3[] hitPointsToTest = this.GetPointsToTest(actHitPoints, absTranslation, axis);
                for (int i = 0; i < hitPointsToTest.Length; i++)
                {
                    Vector3 relHitPoint = MainWorld.AbsToRelative(hitPointsToTest[i]);
                    if (this.mWorld.HasPointCollision(hitPointsToTest[i]))
                    {
                        /* Compute the possible translation */
                        float val = 0;
                        if (axis == Vector3.UNIT_Y)
                        {
                            float blockHeight = Cst.CUBE_SIDE;
                            if (mWorld.getIsland().getBlock(relHitPoint, false) is SnowEighthBlock)
                            {
                                blockHeight /= 8;
                            }
                            if (this.GetNonNullValue(absTranslation * axis) < 0)
                            {
                                val = (relHitPoint.y * Cst.CUBE_SIDE + blockHeight) - this.mCharac.FeetPosition.y;
                            }
                        }
                        else
                        {
                            this.WasHorizontalCollision = true;
                        }

                        actTranslation = (actTranslation * (Vector3.UNIT_SCALE - axis)) + val * axis;    // Update the actTranslation
                        break;
                    }
                }
            }

            this.HasHorizontalCollisionEnded = wasHCollision && !this.WasHorizontalCollision;
            return(actTranslation);
        }
示例#7
0
 public MainFeature(MainWorld world)
 {
     Systems = new LazyECS.Systems()
               .Add(new CreateCubeEntitySystem(world))
               .Add(new UpdateCubePositionSystem(world))
               .Add(new MoveGameObjectSystem(world))
               .Add(new TestTeardownSystem())
               .Add(new TestCleanupSystem());
 }
示例#8
0
        public void LoadProject(string folderPath, string sourcePath)
        {
            if (MainWorld.Map != null)
            {
                MainWorld.UnloadMap();
            }

            MainWorld.LoadMapFromDirectory(folderPath, sourcePath);
        }
示例#9
0
        /// <summary>
        /// Adds a <c><![CDATA[<script>]]></c> tag into the page with the desired url or content
        /// </summary>
        /// <param name="options">add script tag options</param>
        /// <returns>Task which resolves to the added tag when the script's onload fires or when the script content was injected into frame</returns>
        /// <seealso cref="Page.AddScriptTagAsync(AddTagOptions)"/>
        /// <seealso cref="Page.AddScriptTagAsync(string)"/>
        public Task <ElementHandle> AddScriptTagAsync(AddTagOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(MainWorld.AddScriptTagAsync(options));
        }
示例#10
0
        /// <summary>
        /// Waits for an expression to be evaluated to a truthy value
        /// </summary>
        /// <param name="script">Expression to be evaluated in browser context</param>
        /// <param name="options">Optional waiting parameters</param>
        /// <returns>A task that resolves when the <c>script</c> returns a truthy value</returns>
        /// <seealso cref="Page.WaitForExpressionAsync(string, WaitForFunctionOptions)"/>
        /// <exception cref="WaitTaskTimeoutException">If timeout occurred.</exception>
        public Task <JSHandle> WaitForExpressionAsync(string script, WaitForFunctionOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(MainWorld.WaitForExpressionAsync(script, options));
        }
示例#11
0
 public MoveGameObjectSystem(MainWorld world)
 {
     mainWorld        = world;
     gameObjectsGroup = mainWorld.CreateGroup(GroupType.All, new HashSet <Type>
     {
         typeof(GameObjectComponent),
         typeof(PositionComponent)
     });
 }
示例#12
0
        /// <summary>
        /// Добавить безусловно новый блок растнеия
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        private void AddNewBlockPlant(int X, int Y)
        {
            TypeBlocks GetBlock = MainWorld.GetTypeBlockMap(X, Y);

            if (GetBlock != TypeBlocks.Blocked)
            {
                StackBlocksPlant.Add(new BlockPlant(X, Y));
                MainWorld.SetPointWorldMap(X, Y, TypeBlocks.Plant);
            }
        }
示例#13
0
        /*public void SetForcedDest(Vector3 dest) // Temp
         * {
         *  this.mForcedDestination.Clear();
         *  this.mForcedDestination.Push(dest);
         *  this.mDestination = dest;
         *  this.mWasAllowedToMove = this.MovementInfo.IsAllowedToMove;
         *  this.MovementInfo.IsAllowedToMove = false;
         *  this.MovementInfo.IsMovementForced = true;
         * }*/

        private void FindPathTo(Vector3 destination)
        {
            if (!(this.mCharacMgr.World.getIsland().getBlock(MainWorld.AbsToRelative(destination), false) is Air))
            {
                Console.WriteLine("path rejected"); return;
            }
            this.mDestination = destination;
            Console.WriteLine("Create pathfinder");
            this.mPathFinder = new PathFinder(this.mDestination, this.BlockPosition, this.mCharacMgr.World.getIsland());
        }
示例#14
0
 internal void Detach()
 {
     Detached = true;
     MainWorld.Detach();
     SecondaryWorld.Detach();
     if (ParentFrame != null)
     {
         ParentFrame.ChildFrames.Remove(this);
     }
     ParentFrame = null;
 }
示例#15
0
        public void OnApplicationRequestSaveAsProject()
        {
            string path = GetUserPath();

            if (path == null)
            {
                return;
            }

            MainWorld.SaveMapToDirectory(path);
        }
        private NetDataWriter CreateRemovePlayerPacket(Entity playerEntity)
        {
            var em = MainWorld.GetOrCreateManager <EntityManager>();

            var msgManager = NetInstance.GetMessageManager();
            var dataWriter = msgManager.Create(m_MsgRemovePlayer);

            dataWriter.Put(playerEntity.Index);

            return(dataWriter);
        }
        protected override void OnCreateManager()
        {
            MainWorld.GetOrCreateManager <AppEventSystem>().SubscribeToAll(this);

            if (NetInstance.ConnectionInfo.ConnectionType != ConnectionType.Self)
            {
                return;
            }

            m_ConnectionPatternManager.RegisterPattern(m_MsgUpdatePlayer);
            m_ConnectionPatternManager.RegisterPattern(m_MsgRemovePlayer);
        }
示例#18
0
 /// <summary>
 /// Добавить новый блок растения по условию роста
 /// </summary>
 /// <param name="X"></param>
 /// <param name="Y"></param>
 /// <param name="OneBlockPlant"></param>
 private void AddNewBlockPlant(int X, int Y, BlockPlant OneBlockPlant)
 {
     if (OneBlockPlant.CanEnergyToGrowth)
     {
         TypeBlocks GetBlock = MainWorld.GetTypeBlockMap(X, Y);
         if (GetBlock != TypeBlocks.Blocked && (GetBlock == TypeBlocks.Void || GetBlock == TypeBlocks.Air))
         {
             OneBlockPlant.SpendEnergyToGrowth();
             StackBlocksPlant.Add(new BlockPlant(X, Y));
             MainWorld.SetPointWorldMap(X, Y, TypeBlocks.Plant);
         }
     }
 }
示例#19
0
        public PathFinder(Vector3 destination, Vector3 start, Island current)   // dest in abs value, start rel
        {
            this.mOpen           = new NodeList <Node>();
            this.mClosed         = new NodeList <Node>();
            this.mPossibleNodes  = new List <Node>();
            this.mSolutionSize   = 0;
            this.mNbTotIter      = 0;
            this.mAbsDestination = destination;
            this.mRelDestination = MainWorld.getRelativeFromAbsolute(this.mAbsDestination);
            this.mCurrent        = current;

            this.mOpen.Add(new Node(this.mRelDestination, start));
        }
示例#20
0
        public void InitMinitorModules()
        {
            Assembly asm = Assembly.GetExecutingAssembly();

            List <string> classlist = new List <string>();

            foreach (Type type in asm.GetTypes())
            {
                if (type.Namespace == "WindEditor.Minitors" && type.GetInterface("IMinitor") != null)
                {
                    IMinitor new_editor = (IMinitor)Activator.CreateInstance(type);
                    MainWorld.InitMinitorModule(new_editor);
                    m_RegisteredMinitors.Add(new_editor);
                }
            }
        }
示例#21
0
        /// <summary>
        /// Waits for a selector to be added to the DOM
        /// </summary>
        /// <param name="xpath">A xpath selector of an element to wait for</param>
        /// <param name="options">Optional waiting parameters</param>
        /// <returns>A task which resolves when element specified by xpath string is added to DOM.
        /// Resolves to `null` if waiting for `hidden: true` and xpath is not found in DOM.</returns>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// var browser = await Puppeteer.LaunchAsync(new LaunchOptions());
        /// var page = await browser.NewPageAsync();
        /// string currentURL = null;
        /// page.MainFrame
        ///     .WaitForXPathAsync("//img")
        ///     .ContinueWith(_ => Console.WriteLine("First URL with image: " + currentURL));
        /// foreach (var current in new[] { "https://example.com", "https://google.com", "https://bbc.com" })
        /// {
        ///     currentURL = current;
        ///     await page.GoToAsync(currentURL);
        /// }
        /// await browser.CloseAsync();
        /// ]]>
        /// </code>
        /// </example>
        /// <seealso cref="WaitForSelectorAsync(string, WaitForSelectorOptions)"/>
        /// <seealso cref="Page.WaitForXPathAsync(string, WaitForSelectorOptions)"/>
        /// <exception cref="WaitTaskTimeoutException">If timeout occurred.</exception>
        public async Task <ElementHandle> WaitForXPathAsync(string xpath, WaitForSelectorOptions options = null)
        {
            var handle = await SecondaryWorld.WaitForXPathAsync(xpath, options).ConfigureAwait(false);

            if (handle == null)
            {
                return(null);
            }
            var mainExecutionContext = await MainWorld.GetExecutionContextAsync().ConfigureAwait(false);

            var result = await mainExecutionContext.AdoptElementHandleASync(handle).ConfigureAwait(false);

            await handle.DisposeAsync().ConfigureAwait(false);

            return(result);
        }
示例#22
0
        public bool Update(BulletManager bulletMgr, float frameTime)
        {
            if (this.mDistTravalled >= this.Range)
            {
                return(false);
            }

            float distance = this.Speed * frameTime;

            this.mDistTravalled += distance;
            this.mYawNode.Translate(distance * this.mForwardDir, Node.TransformSpace.TS_LOCAL);

            if (this.mAccurateTest)
            {
                this.mRay.Origin = this.mYawNode.Position;

                if (
                    !(bulletMgr.World.getIsland()
                      .getBlock(MainWorld.getRelativeFromAbsolute(this.mYawNode.Position), false) is Air))
                {
                    return(false);
                }

                RaySceneQuery raySQuery = bulletMgr.SceneMgr.CreateRayQuery(this.mRay);
                raySQuery.SetSortByDistance(true);

                foreach (RaySceneQueryResultEntry raySQREntry in raySQuery.Execute())
                {
                    if (raySQREntry.movable != null && raySQREntry.distance > 0 && raySQREntry.distance <= distance)
                    {
                        string[] s = raySQREntry.movable.Name.Split('_');
                        if (s.Length == 2 && s[0] == "CharacterEnt")
                        {
                            int id = int.Parse(s[1]);
                            if (id != this.mSource.Info.Id)
                            {
                                bulletMgr.CharacMgr.GetCharacterById(id).Hit(this.Damage, this.mSource);
                                return(false);
                            }
                        }
                    }
                }
            }

            return(true);
        }
示例#23
0
        /// <summary>
        /// Функция падения (необходимо проверить будет баговать при гравитации >1)
        /// </summary>
        public void Fall()
        {
            int newY;

            if (Y > MainWorld.PropertyGravitation)
            {
                newY = Y - MainWorld.PropertyGravitation;
            }
            else
            {
                newY = 0;
            }
            if (fall && MainWorld.MovePointWorldMap(X, Y, X, newY))
            {
                Y    = newY;
                fall = false;
            }
        }
        /// <summary>
        /// Create a packet who contains data about the player
        /// </summary>
        /// <param name="playerEntity"></param>
        /// <param name="owned"></param>
        /// <returns></returns>
        private NetDataWriter CreatePlayerDataPacket(Entity playerEntity, NetPeer peer)
        {
            var em         = MainWorld.GetOrCreateManager <EntityManager>();
            var peerLink   = em.GetSharedComponentData <PlayerPeerLink>(playerEntity);
            var userLink   = em.GetSharedComponentData <PlayerUserLink>(playerEntity);
            var masterLink = em.GetSharedComponentData <MasterServerPlayerId>(playerEntity);

            var msgManager = NetInstance.GetMessageManager();
            var dataWriter = msgManager.Create(m_MsgUpdatePlayer);

            // The index is used to determin the id of the entity in the server
            dataWriter.Put(StMath.DoubleIntToLong(playerEntity.Index, playerEntity.Version));
            dataWriter.Put(userLink.Target.Index);
            dataWriter.Put(masterLink.Id);
            dataWriter.Put(peerLink.Target == peer);

            return(dataWriter);
        }
        void EventConnectionRequest.IEv.Callback(EventConnectionRequest.Arguments args)
        {
            var caller  = args.Caller;
            var request = args.Request;

            if (caller != NetInstance || !NetInstance.SelfHost)
            {
                return;
            }

            // TODO: This is only temporary, this should be moved to somewhere else
            var playerId = request.Data.GetIdent128();

            var em     = MainWorld.GetOrCreateManager <EntityManager>();
            var plBank = MainWorld.GetOrCreateManager <GamePlayerBank>();
            var player = plBank.GetPlayerFromIdent(playerId);

            if (!player.IsCreated)
            {
                player = new GamePlayer(em.CreateEntity());
                var masterServerPlayerId = new MasterServerPlayerId()
                {
                    Id = playerId
                };

                em.SetOrAddSharedComponentData(player.WorldPointer, masterServerPlayerId);
                plBank.AddPlayer(masterServerPlayerId, player);
            }
            else
            {
                var masterServerPlayerId = new MasterServerPlayerId()
                {
                    Id = playerId
                };

                em.SetOrAddSharedComponentData(player.WorldPointer, masterServerPlayerId);
            }

            m_ConnectionPlayerBank.RegisterPlayer(StMath.DoubleIntToLong(player.WorldPointer.Index, player.WorldPointer.Version), player);

            var peer = request.Accept();

            em.SetOrAddSharedComponentData(player.WorldPointer, new PlayerPeerLink(caller.PeerInstance, peer));
        }
示例#26
0
        public void OnApplicationRequestSaveProject()
        {
            // Data was loaded from archives to a temp folder. We need a new folder to copy this data to!
            if (MainWorld.Map.SavePath == null)
            {
                string path = GetUserPath();
                if (path == null)
                {
                    return;
                }

                string newMapDir = $"{ path }\\{ MainWorld.Map.MapName }";
                CopyTempDataToPermanentDir(m_sourceDataPath, newMapDir);

                MainWorld.Map.SavePath = newMapDir;
            }

            MainWorld.SaveMapToDirectory("");
        }
示例#27
0
        public static float getBlockOnRay(Island island, Ray ray, float distMax, float minDist,
                                          out Vector3 relBlockPos, out Block actBlock)
        {
            float distance = minDist;

            relBlockPos = MainWorld.AbsToRelative(ray.GetPoint(distance));

            do
            {
                Vector3 prevRelBlockPos = relBlockPos;
                while (prevRelBlockPos == relBlockPos)
                {
                    distance   += 3;
                    relBlockPos = MainWorld.AbsToRelative(ray.GetPoint(distance));
                }
                actBlock = island.getBlock(relBlockPos, false);
            } while (actBlock is Air && distance < distMax);

            return(distance);
        }
示例#28
0
        public void OnApplicationRequestSaveAsProject()
        {
            var ofd = new CommonOpenFileDialog();

            ofd.Title                     = "Choose Directory";
            ofd.IsFolderPicker            = true;
            ofd.AddToMostRecentlyUsedList = false;
            ofd.AllowNonFileSystemItems   = false;
            ofd.EnsureFileExists          = true;
            ofd.EnsurePathExists          = true;
            ofd.EnsureReadOnly            = false;
            ofd.EnsureValidNames          = true;
            ofd.Multiselect               = false;
            ofd.ShowPlacesList            = true;

            if (ofd.ShowDialog() == CommonFileDialogResult.Ok)
            {
                // Just assume the folder paths are valid now.
                MainWorld.SaveMapToDirectory(ofd.FileName);
            }
        }
        /// <summary>
        /// On broadcasting data, send all connected players to the new peer
        /// </summary>
        /// <param name="peerInstance"></param>
        public override void OnInstanceBroadcastingData(NetPeerInstance peerInstance)
        {
            if (!NetInstance.SelfHost)
            {
                return;
            }

            var chanManager = NetInstance.GetChannelManager();
            var plBank      = MainWorld.GetOrCreateManager <GamePlayerBank>();
            var gpSystem    = MainWorld.GetOrCreateManager <GamePlayerSystem>();
            var em          = MainWorld.GetOrCreateManager <EntityManager>();

            var connectedPlayers = gpSystem.SlowGetAllConnectedPlayers();

            for (int i = 0; i != connectedPlayers.Length; i++)
            {
                var entity = connectedPlayers.Entities[i];
                if (em.HasComponent <PlayerPeerLink>(entity))
                {
                    var dataWriter = CreatePlayerDataPacket(entity, (NetPeer)peerInstance);
                    chanManager.DefaultChannel.Manager.SendToAll(dataWriter, DeliveryMethod.ReliableOrdered);
                }
            }
        }
示例#30
0
 /// <summary>
 /// Adds a <c><![CDATA[<script>]]></c> tag into the page with the desired url or content
 /// </summary>
 /// <param name="options">add script tag options</param>
 /// <returns>Task which resolves to the added tag when the script's onload fires or when the script content was injected into frame</returns>
 /// <seealso cref="Page.AddScriptTagAsync(AddTagOptions)"/>
 /// <seealso cref="Page.AddScriptTagAsync(string)"/>
 public Task <ElementHandle> AddScriptTagAsync(AddTagOptions options) => MainWorld.AddScriptTagAsync(options);
示例#31
0
    // =====================================================================
    private static void Updater()
    {
        // -----------------------------------------------------------------
        int[] fieldSize = {90, 34};
        // -----------------------------------------------------------------
        MW = new MainWorld(fieldSize);
        MW.Init();

        aTimer = new Timer();
        InitTimer();
        // -----------------------------------------------------------------
        while(true){

            //CKI = Console.ReadKey();
            if(!MW.isAlife){
                aTimer.AutoReset = false;
                aTimer.Enabled = false;
                aTimer.Dispose();
                Console.Clear();
                YouLose();
                break;
            }else{

                if(!DEBUG)
                    MW.UpdateUserPos(Console.ReadKey().Key);
            }
        }
        // -----------------------------------------------------------------
    }
 public ThreadTerrainRegenerate(Island current, MainWorld world)
 {
     this.mIsland = current;
     this.mWorld  = world;
 }