private async void OnReceiveData(IResponse response)
        {
            if (response is TGetAllObjectsDataResponse getAllObjectsResponse)
            {
                Objects.Clear();
                foreach (var identifier in getAllObjectsResponse.Identifiers)
                {
                    Objects.Add(new TObjectViewModel {
                        Id = identifier
                    });
                    await _communicator.SendAsync(new TGetObjectDescriptionDataRequest { Identifier = identifier });
                }
            }

            if (response is TGetObjectDescriptionDataResponse getObjectDescriptionResponse)
            {
                var objectViewModel = Objects.FirstOrDefault(x => x.Id == getObjectDescriptionResponse.Identifier);
                if (objectViewModel != null)
                {
                    objectViewModel.Description = getObjectDescriptionResponse.Description;
                }
            }

            if (response is TCreateObjectDataResponse createObjectResponse && _newObjects.TryGetValue(createObjectResponse.ClientObjectIdentifier, out var description))
            {
                Objects.Add(new TObjectViewModel {
                    Id = createObjectResponse.Identifier, Description = description
                });
            }
        }
        private void readJson(JToken node, ReadingOptions options)
        {
            X        = node.Value <float>("x");
            Y        = node.Value <float>("y");
            Z        = node.Value <float>("z");
            UnkByte  = node.Value <byte>("unkByte");
            UnkFloat = node.Value <float>("unkFloat");

            ZoneVolumes.Clear();
            JArray zones = node.Value <JArray>("zones");

            if (zones != null && zones.Type != JTokenType.Null)
            {
                foreach (JToken zone in zones)
                {
                    ZoneVolumes.Add(ArkName.From(zone.Value <string>()));
                }
            }

            Objects.Clear();
            ObjectMap.Clear();
            JArray objectsNode = node.Value <JArray>("objects");

            if (objectsNode != null && objectsNode.Type != JTokenType.Null)
            {
                foreach (var jsonNode in objectsNode)
                {
                    addObject(new GameObject((JObject)jsonNode, options.HibernationObjectProperties), options.BuildComponentTree);
                }
            }

            UnkInt1    = node.Value <int>("unkInt1");
            ClassIndex = node.Value <int>("classIndex");
        }
예제 #3
0
 /// <summary>
 /// Deletes all objects in the region.
 /// </summary>
 public void Clear()
 {
     lock (_mutex)
     {
         Objects.Clear();
     }
 }
예제 #4
0
        /// <summary>
        /// Instantiates goals around the base of the arena
        /// </summary>
        /// <param name="number">How many goas shoudl be instantiated</param>
        /// <param name="positions">Indices of goals to actually be instantiated</param>
        /// <param name="radius">Radius of the arena</param>
        /// <param name="center">XYZ coordinates of the perfect center of the area</param>
        /// <returns></returns>
        public List <GoalController> InstantiateGoalsCircumference(int number, int[] positions = null, float radius = 15,
                                                                   Vector3 center = default(Vector3))
        {
            //validations
            if (positions != null)
            {
                if (positions.Max() > number - 1)
                {
                    Debug.Log("Cannot instantiate goals on positions higher than number of goals");
                    return(null);
                }
            }
            else
            {
                positions = Enumerable.Range(0, number).ToArray();
            }

            Objects.Clear();
            foreach (var i in positions)
            {
                var goal = Instantiate(GoalPrefab, default(Vector3), default(Quaternion));
                if (goal == null)
                {
                    continue;
                }
                goal.transform.SetParent(gameObject.transform);
                var goalController = goal.GetComponent <GoalController>();
                Objects.Add(goalController);
            }
            MoveObjectsCircumference(number, positions, radius, center);
            return(Objects.Cast <GoalController>().ToList());
        }
예제 #5
0
        public void AddObject(GameObject3D newObject)
        {
            if (Nodes.Count == 0)
            {
                if (Objects.Count < MaxObjects)
                {
                    Objects.Add(newObject);
                }
                else
                {
                    Subdivide();

                    foreach (GameObject3D go in Objects)
                    {
                        Distribute(go);
                    }

                    Objects.Clear();
                }
            }
            else
            {
                Distribute(newObject);
            }
        }
예제 #6
0
        public void ReadBinary(ArkArchive archive, ReadingOptions options)
        {
            TribeVersion = archive.ReadInt();

            if (TribeVersion != 1)
            {
                throw new NotSupportedException("Unknown Tribe Version " + TribeVersion);
            }

            int tribesCount = archive.ReadInt();

            Objects.Clear();
            ObjectMap.Clear();
            for (int i = 0; i < tribesCount; i++)
            {
                addObject(new GameObject(archive), options.BuildComponentTree);
            }

            for (int i = 0; i < tribesCount; i++)
            {
                GameObject gameObject = Objects[i];
                if (gameObject.ClassString == "PrimalTribeData")
                {
                    Tribe = gameObject;
                }

                gameObject.LoadProperties(archive, i < tribesCount - 1 ? Objects[i + 1] : null, 0);
            }
        }
예제 #7
0
 public void Dispose()
 {
     xAxis = null;
     yAxis = null;
     disabledPen?.Dispose();
     disabledPen = null;
     dfEventInfo = null;
     dfRenderer?.Dispose();
     dfRenderer  = null;
     dfLine      = null;
     dfRect      = null;
     dfAreaF     = null;
     dfArea      = null;
     dfEventArgs = null;
     sysFont     = null;
     imageProcessor?.Dispose();
     imageProcessor = null;
     IsClosing      = true;
     lock (Sync)
     {
         foreach (var dict in Objects.Values)
         {
             foreach (var item in dict.Values.OfType <IDisposable>())
             {
                 item.Dispose();
             }
             dict.Clear();
         }
         Objects.Clear();
         newIDs.Clear();
     }
     Dispose2();
 }
예제 #8
0
 public void LoadLevel(bool player)
 {
     Modifier.modifyGame();
     HitObjects.Clear();
     Objects.Clear();
     HP.Clear();
     Score = 0;
     Combo = 0;
     Lives = Modifier.Lives();
     Block.RegisterBlock("Platform", typeof(Platform));
     Block.RegisterBlock("Player", typeof(Player));
     Objects.Add(Block.CreateBlock("Platform", 100, 10, 0, 525, DefaultColor));
     Objects.Add(Block.CreateBlock("Platform", 100, 10, 700, 525, DefaultColor));
     Objects.Add(Block.CreateBlock("Platform", 100, 10, 150, 450, DefaultColor));
     Objects.Add(Block.CreateBlock("Platform", 100, 10, 550, 450, DefaultColor));
     Objects.Add(Block.CreateBlock("Platform", 200, 10, 300, 375, DefaultColor));
     HP.Add(new HP(Color.OrangeRed, 25, 490, 50, 25, false, "HP"));
     HP.Add(new HP(Color.OrangeRed, 725, 490, 50, 25, false, "HP"));
     HP.Add(new HP(Color.OrangeRed, 175, 415, 50, 25, false, "HP"));
     HP.Add(new HP(Color.OrangeRed, 575, 415, 50, 25, false, "HP"));
     HP.Add(new HP(Color.IndianRed, 375, 340, 50, 25, false, "MAX"));
     if (player)
     {
         Objects.Add(Block.CreateBlock("Player", 75, 50, 200, 550, Color.OrangeRed));
     }
 }
예제 #9
0
파일: dd.cs 프로젝트: Radviger/MultiV
    private void StartRace(Race race)
    {
        race = new Race(race);

        CurrentRace = race;

        Opponents.ForEach(op =>
        {
            if (!op.Vehicle.IsNull)
            {
                API.deleteEntity(op.Vehicle);
            }

            API.unspectatePlayer(op.Client);
        });

        foreach (var ent in Objects)
        {
            API.deleteEntity(ent);
        }

        Objects.Clear();

        foreach (var prop in race.DecorativeProps)
        {
            Objects.Add(API.createObject(prop.Hash, prop.Position, prop.Rotation));
        }

        var clients = API.getAllPlayers();

        for (int i = 0; i < clients.Count; i++)
        {
            SetUpPlayerForRace(clients[i], CurrentRace, true, i);
        }

        RaceStart = DateTime.UtcNow;

        API.consoleOutput("RACE: Starting race " + race.Name);
        IsRaceStarting = true;

        var t = new Thread((ThreadStart) delegate
        {
            Thread.Sleep(10000);
            IsRaceStarting = false;
            API.triggerClientEventForAll("startRaceCountdown");
            Thread.Sleep(3000);
            IsRaceOngoing = true;

            var nat = 0x428CA6DBD1094446;

            lock (Opponents)
                foreach (var opponent in Opponents)
                {
                    API.setEntityPositionFrozen(opponent.Client, opponent.Vehicle, false);
                }
        });

        t.IsBackground = true;
        t.Start();
    }
예제 #10
0
        internal void MoveObjectsToStorage(Farmer who)
        {
            Log.D($"Moving objects to Storage from {Name}",
                  ModEntry.Instance.Config.DebugMode);

            foreach (var obj in Objects.Values)
            {
                if (obj.GetType() != typeof(Chest))
                {
                    ModEntry.AddToStorage(who, obj);
                }
                else
                {
                    // Deposit chest contents into storage
                    foreach (var chest in ((Chest)obj).items)
                    {
                        ModEntry.AddToStorage(who, chest);
                    }
                    ModEntry.AddToStorage(who, (Chest)obj);
                }
            }
            Objects.Clear();

            // TODO: BUGS: Ensure decoratable location issues with locations added by TMXL are resolved

            foreach (var f in furniture)
            {
                ModEntry.AddToStorage(who, f);
            }
            furniture.Clear();
        }
예제 #11
0
        public void AddObject(GameObject3D newObject)
        {
            if (Nodes.Count == 0)
            {
                bool maxObjectReached = Objects.Count > MaxNumberOfObjects;

                if (maxObjectReached)
                {
                    SubDivide();

                    foreach (var obj in Objects)
                    {
                        Distrubte(obj);
                    }

                    Objects.Clear();
                }
                else
                {
                    Objects.Add(newObject);
                }
            }
            else
            {
                Distrubte(newObject);
            }
        }
예제 #12
0
 private void Clear()
 {
     Objects.Clear();
     ClassCounters.Clear();
     ClassNames.Clear();
     FeaturesIDs.Clear();
 }
예제 #13
0
 /// <summary>
 /// Instantiates
 /// </summary>
 /// <param name="Rooms"></param>
 public RoomDisplay(List <OrgRoom> Rooms) : base()
 {
     InitializeComponent();
     Objects.Clear();
     Objects.AddRange(Rooms);
     Text = "Room Display";
 }
예제 #14
0
 public void ClearObjects()
 {
     while (ObjectsInView.Count > 0)
     {
         ObjectsInView.RemoveAt(ObjectsInView.Count - 1);
     }
     Objects.Clear();
 }
예제 #15
0
 //Extra comment
 /// <summary>
 /// Clears the feedback
 /// </summary>
 public void Clear()
 {
     foreach (GameObject shot in Objects)
     {
         GameObject.Destroy(shot);
     }
     Objects.Clear();
 }
예제 #16
0
 /// <summary>
 /// Instantiates
 /// </summary>
 /// <param name="Teams"></param>
 public TeamDisplay(List <OrgTeam> Teams) : base()
 {
     InitializeComponent();
     Objects.Clear();
     Objects.AddRange(Teams);
     Text = "Team Display";
     //DisableAugmentList();
 }
예제 #17
0
 public void PrepareObjects()
 {
     if (grouping == GroupingMethod.DistanceR)
     {
         foreach (GeometricObject obj in Objects)
         {
             box.Union(obj.GetBoundingBox());
         }
     }
     else if (grouping == GroupingMethod.DistanceM)
     {
         temp.Sort(new SortByBoundingBox());
         int div = temp.Count / n;
         int rem = temp.Count % n;
         for (int i = 0; i < div * n; i += n)
         {
             Group group = new Group(Name + "Group" + gcount);
             gcount++;
             for (int f = 0; f < n; f++)
             {
                 int num = i + f;
                 group.AddObject(temp[num]);
             }
             Objects.Add(group);
             box.Union(group.GetBoundingBox());
         }
         for (int i = 0; i < rem; i++)
         {
             Objects.Add(temp[temp.Count - 1 - rem]);
         }
         temp.Clear();
         while (Objects.Count > n)
         {
             temp = new List <GeometricObject>(Objects);
             Objects.Clear();
             temp.Sort(new SortByBoundingBox());
             int div2 = temp.Count / n;
             int rem2 = temp.Count % n;
             for (int i = 0; i < div2 * n; i += n)
             {
                 Group group = new Group(Name + "Group" + gcount);
                 gcount++;
                 for (int f = 0; f < n; f++)
                 {
                     int num = i + f;
                     group.AddObject(temp[num]);
                 }
                 Objects.Add(group);
                 box.Union(group.GetBoundingBox());
             }
             for (int i = 0; i < rem2; i++)
             {
                 Objects.Add(temp[temp.Count - 1 - rem2]);
             }
             temp.Clear();
         }
     }
 }
예제 #18
0
 public void RemoveAll()
 {
     OnRemoveAll();
     Objects.Clear();
     index             = 0;
     IsIncreasingStick = false;
     IsAbleToIncrease  = true;
     Objects           = new List <Stick>();
 }
        public void UpdateGlobal( )
        {
            Context.NotifySpeckleFrame("client-log", StreamId, JsonConvert.SerializeObject("Global update received."));

            try
            {
                var streamGetResponse = Client.StreamGet(StreamId);
                if (streamGetResponse.Success == false)
                {
                    Context.NotifySpeckleFrame("client-error", StreamId, streamGetResponse.Message);
                    Context.NotifySpeckleFrame("client-log", StreamId, JsonConvert.SerializeObject("Failed to retrieve global update."));
                }


                Client.Stream = streamGetResponse.Stream;
                var COPY = Client.Stream;
                Context.NotifySpeckleFrame("client-metadata-update", StreamId, Client.Stream.ToJson());
                Context.NotifySpeckleFrame("client-is-loading", StreamId, "");

                // prepare payload
                PayloadObjectGetBulk payload = new PayloadObjectGetBulk();
                payload.Objects = Client.Stream.Objects.Where(o => !Context.SpeckleObjectCache.ContainsKey(o));

                // bug in speckle core, no sync method for this :(
                Client.ObjectGetBulkAsync("omit=displayValue", payload).ContinueWith(tres =>
                {
                    if (tres.Result.Success == false)
                    {
                        Context.NotifySpeckleFrame("client-error", StreamId, streamGetResponse.Message);
                    }
                    var copy = tres.Result;

                    // add to cache
                    foreach (var obj in tres.Result.Objects)
                    {
                        Context.SpeckleObjectCache[obj.DatabaseId] = obj;
                    }

                    // populate real objects
                    Objects.Clear();
                    foreach (var objId in Client.Stream.Objects)
                    {
                        Objects.Add(Context.SpeckleObjectCache[objId]);
                    }

                    DisplayContents();
                    Context.NotifySpeckleFrame("client-done-loading", StreamId, "");
                });
            }
            catch (Exception err)
            {
                Context.NotifySpeckleFrame("client-error", Client.Stream.StreamId, JsonConvert.SerializeObject(err.Message));
                Context.NotifySpeckleFrame("client-done-loading", StreamId, "");
                return;
            }
        }
예제 #20
0
 public void Dispose()
 {
     foreach (var anonymousObject in Objects)
     {
         anonymousObject.Dispose();
     }
     Objects.Clear();
     ClassInfo = null;
     Reference = null;
 }
예제 #21
0
        public void Update(ExchangeLeaveMessage message)
        {
            if ((DialogTypeEnum)message.DialogType == DialogTypeEnum.DIALOG_EXCHANGE && _account.State == AccountStates.STORAGE)
            {
                _account.State = AccountStates.NONE;
                Objects.Clear();
                Kamas = 0;

                StorageLeft?.Invoke();
            }
        }
예제 #22
0
 void LoadMap()
 {
     using (var stream = new System.IO.FileStream("./Content/Levels/Level_01.png", System.IO.FileMode.Open))
     {
         Map.Load(Texture2D.FromStream(Game.Graphics.GraphicsDevice, stream));
         Objects.Clear();
         Objects.AddRange(Map.GetObstacles());
         Enemies.Clear();
         Enemies.AddRange(Map.GetEnemies());
     }
 }
예제 #23
0
        public void Clear()
        {
            Objects.Clear();

            foreach (var node in Nodes)
            {
                ClearNode(node);
            }

            Nodes.Clear();
        }
예제 #24
0
    public override void Reset()
    {
        Objects.Clear();
        Mfa.Reset();
        Quiet = true;
        BypassGovernanceRetention = null;
        ContentMd5   = null;
        RequestPayer = Payer.Unknown;

        base.Reset();
    }
예제 #25
0
        public override void ReadObjects()
        {
            Objects.Clear();

            var objects = Model.GetObjects(DacQueryScopes.UserDefined, TypeClass);

            foreach (var obj in objects)
            {
                Objects.Add(obj.Name.ToString());
            }
        }
예제 #26
0
    public void MapChange(string mapName, XmlGroup map)
    {
        EndRace();

        API.consoleOutput("Parsing map...");
        var race = new Race(parseRace(mapName, map));

        API.consoleOutput("Map parse done! Race null? " + (race == null));

        CurrentRace = race;

        Opponents.ForEach(op =>
        {
            op.HasFinished       = false;
            op.CheckpointsPassed = 0;
            op.TimeFinished      = "";
            if (!op.Vehicle.IsNull)
            {
                API.deleteEntity(op.Vehicle);
            }

            API.freezePlayer(op.Client, true);
        });

        if (Objects != null)
        {
            foreach (var ent in Objects)
            {
                API.deleteEntity(ent);
            }

            Objects.Clear();
        }
        else
        {
            Objects = new List <NetHandle>();
        }

        var clients = API.getAllPlayers();

        for (int i = 0; i < clients.Count; i++)
        {
            API.freezePlayer(clients[i], false);

            SetUpPlayerForRace(clients[i], CurrentRace, true, i);
        }

        CurrentRaceCheckpoints = race.Checkpoints.ToList();
        RaceStart = DateTime.UtcNow;

        API.consoleOutput("RACE: Starting race " + race.Name);

        RaceStartCountdown = 13;
    }
예제 #27
0
파일: Canvas.cs 프로젝트: kuggaa/longomatch
 /// <summary>
 /// Removes all the objects from the canvas.
 /// </summary>
 protected virtual void ClearObjects()
 {
     if (Objects != null)
     {
         foreach (ICanvasObject co in Objects)
         {
             co.RedrawEvent -= HandleRedrawEvent;
             co.Dispose();
         }
         Objects.Clear();
     }
 }
예제 #28
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                Objects.Clear();
                RemoteObjects.Clear();
                Objects       = null;
                RemoteObjects = null;
                _account      = null;

                _disposedValue = true;
            }
        }
예제 #29
0
 public void Unload()
 {
     foreach (MapObject mo in Objects)
     {
         mo.DisposeNoUnlink();
     }
     Objects.Clear();
     Players.Clear();
     ConsolePlayer = null;
     FileName      = null;
     MapStructure  = null;
     GameManager.Instance.MapView.Unload();
 }
예제 #30
0
파일: QuadTree.cs 프로젝트: siquel/BeatEmUp
 public void Clear()
 {
     Objects.Clear();
     for (int index = 0; index < Nodes.Length; index++)
     {
         if (Nodes[index] == null)
         {
             break;
         }
         Nodes[index].Clear();
         Nodes[index] = null;
     }
 }