protected virtual T CreateNew() { var result = _createFunc.Invoke(); OnCreate?.Invoke(result); return(result); }
public void ProcessQueue() { Dictionary <Guid, ToDoItem> items = new Dictionary <Guid, ToDoItem>(); ToDoItem toDoItem; while (queue.TryDequeue(out toDoItem)) { items[toDoItem.EditId] = toDoItem; } foreach (var item in items) { ToDoItemEventArgs args = new ToDoItemEventArgs { Item = item.Value }; if (item.Value.MarkedForRemoval) { // TODO: Remove from database here OnRemove?.Invoke(this, args); continue; } // TODO: Database Update Here // TEMP if (item.Value.Id == 0) { item.Value.Id = rd.Next(1, 9999); OnCreate?.Invoke(this, args); } OnUpdate?.Invoke(this, args); } }
void OnGUI() { GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.BeginVertical(); EditorGUILayout.LabelField("Create new Graph:", EditorStyles.boldLabel); curName = EditorGUILayout.TextField("Enter name", curName); GUILayout.Space(10); GUILayout.BeginHorizontal(); if (GUILayout.Button("Create Graph", GUILayout.Height(40))) { if (!string.IsNullOrWhiteSpace(curName)) { OnCreate?.Invoke(NodeUtils.CreateNewGraph(curName)); curPopup.Close(); } else { EditorUtility.DisplayDialog("Node Message:", "Please enter a valid name!", "OK"); } } if (GUILayout.Button("Cancel", GUILayout.Height(40))) { curPopup.Close(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(20); GUILayout.EndHorizontal(); GUILayout.Space(20); }
//----------------------------------------// //----- FUNÇÕES -----// //----------------------------------------// protected override void _Update(GameTime gameTime) { delayTime += gameTime.ElapsedGameTime.Milliseconds; if (delayTime >= Delay) { Ghost ghost = new Ghost(); ghost.Sprite = entity.CurrentAnimation.CurrentSprite; ghost.Frame = entity.CurrentAnimation.CurrentFrame; ghost.Position = entity.Transform.Position; ghost.Rotation = entity.Transform.Rotation; ghost.Scale = entity.Transform.Scale; ghost.LayerDepth = entity.Transform.LayerDepth; ghost.Effects = entity.Transform.SpriteEffects; ghost.Origin = entity.Transform.Origin; ghosts.Add(ghost); delayTime = 0; OnCreate?.Invoke(entity, ghost); } for (int i = 0; i < ghosts.Count; i++) { ghosts[i].ElapsedTime += gameTime.ElapsedGameTime.Milliseconds; if (ghosts[i].ElapsedTime >= Time) { OnRemove?.Invoke(entity, ghosts[i]); ghosts.RemoveAt(i); } } }
public void Execute(World world) { OnReplace?.Invoke(world); OnRemove?.Invoke(world); OnCreate?.Invoke(world); OnSeed?.Invoke(world); }
public void Menu() { bool exit = false; while (!exit) { Console.WriteLine($"\n\t\t\t {typeof(T).Name} Menu" + $"\n\t1.Create {typeof(T).Name}" + $"\n\t2.Read {typeof(T).Name}" + $"\n\t3.Update {typeof(T).Name}" + $"\n\t4.Delete {typeof(T).Name}" + $"\n\t5.GetCollection of {typeof(T).Name}" + $"\n\t6.ReadFromFile" + $"\n\t7.WriteInFile" + $"\n\tanother.Exit\n"); ConsoleKeyInfo consoleKey = Console.ReadKey(); Console.WriteLine(); switch (consoleKey.Key) { case ConsoleKey.D1: OnCreate?.Invoke(this, EventArgs.Empty); break; case ConsoleKey.D2: OnRead?.Invoke(this, EventArgs.Empty); break; case ConsoleKey.D3: OnUpdate?.Invoke(this, EventArgs.Empty); break; case ConsoleKey.D4: OnDelete?.Invoke(this, EventArgs.Empty); break; case ConsoleKey.D5: OnReadCollection?.Invoke(this, EventArgs.Empty); break; case ConsoleKey.D6: OnReadFromFile?.Invoke(this, EventArgs.Empty); break; case ConsoleKey.D7: OnWriteInFile?.Invoke(this, EventArgs.Empty); break; default: exit = true; break; } Console.ReadKey(); Console.Clear(); } }
public override Cell Create(int param1, int param2) { var ret = base.Create(param1, param2); OnCreate?.Invoke(ret); return(ret); }
public IConnection Create(Serializer serializer, IPEndPoint endpoint, Configuration configuration) { var connection = _func(endpoint); var queue = CreatedConnections.GetOrAdd(endpoint, _ => new ConcurrentQueue <IConnection>()); queue.Enqueue(connection); OnCreate?.Invoke(connection); return(connection); }
public IConnection Create(ISerializer serializer, IConnectionEndPoint endpoint, Configuration configuration, IConnectionObserver connectionObserver) { var connection = _func(endpoint); var queue = CreatedConnections.GetOrAdd(endpoint.GetHostIpEndPointWithFallback(), _ => new ConcurrentQueue <IConnection>()); queue.Enqueue(connection); OnCreate?.Invoke(connection); return(connection); }
private static void GameObjectOnCreate(GameObject sender, EventArgs args) { var obj = sender as T; if (obj != null) { OnCreate?.Invoke(null, obj); } }
private void Start() { UpdateView(); if (isInvisible) { blockCollider = GetComponent <Collider2D>(); SetAccessible(false); } OnCreate?.Invoke(isUnderstroyable); }
/// <summary>Initializes a new instance of the <see cref="Scene" /> class.</summary> /// <param name="name">The name.</param> /// <param name="gameObjects">The game objects.</param> public Scene([NotNull] string name, [NotNull] params GameObject[] gameObjects) { this.name = name; this.gameObjects = new List <GameObject>(gameObjects); OnCreate += Scene_OnCreate; OnDestroy += Scene_OnDestroy; OnCreate.Invoke(this, true); }
public Scene([NotNull] string name, [NotNull] List <GameObject> gameObjects) { this.name = name; this.gameObjects = gameObjects; OnCreate += Scene_OnCreate; OnDestroy += Scene_OnDestroy; OnCreate.Invoke(this, true); }
public Config([NotNull] string name) { this.name = name; OnCreate += Config_OnCreate; OnDestroy += Config_OnDestroy; OnChangeName += Config_OnChangeName; OnCreate.Invoke(this, true); }
public void SetUp(LocalPlayerProperty _data, int _i) { OnCreate?.Invoke(_i); rigid = gameObject.GetComponent <Rigidbody2D>(); listeners = gameObject.GetComponent <PhysicsControlListeners>(); actionController = gameObject.GetComponent <ActionController>(); SetUpLocalEvent(); dataIndex = _i; Head _newHead = Instantiate( Head.LoadHead(PlayerSlot.heads_res[(int)_data.playerProperty[CustomPropertyCode.HEAD_CDOE]].name).gameObject, head.transform.position, Quaternion.identity, head.transform.parent ).GetComponent <Head>(); Body _newBody = Instantiate( //Body.LoadBody(_data.playerProperty[CustomPropertyCode.BODY_CODE] as string).gameObject, Body.LoadBody(PlayerSlot.body_res[(int)_data.playerProperty[CustomPropertyCode.BODY_CODE]].name).gameObject, body.transform.position, Quaternion.identity, body.transform.parent ).GetComponent <Body>(); Destroy(head.gameObject); Destroy(body.gameObject); head = _newHead; body = _newBody; body.GetComponent <PlayerAttackControl>()._player = this; head.ApplyBuff(); //********Set Keys ***************** SetKey(_i); //set team Layer //gameObject.layer = LayerMask.NameToLayer("Player" + _data.playerProperty[CustomPropertyCode.TEAM_CODE]); gameObject.layer = LayerMask.NameToLayer("Player" + _data.playerProperty[CustomPropertyCode.TEAM_LAYER]); int _team_code = (int)_data.playerProperty[CustomPropertyCode.TEAM_CODE]; Debug.Log("set Team color " + CustomPropertyCode.TEAMCOLORS[_team_code] + " " + _team_code); //set team color head.GetComponent <SpriteRenderer>().color = CustomPropertyCode.TEAMCOLORS[_team_code]; body.GetComponent <SpriteRenderer>().color = CustomPropertyCode.TEAMCOLORS[_team_code]; //Landing animation (called by manager) //AddLanding(); //Test: //AddRevive(); }
public virtual void Create(AuthenticationTokenCreateContext context) { if (OnCreateAsync != null && OnCreate == null) { throw new InvalidOperationException(Resources.Exception_AuthenticationTokenDoesNotProvideSyncMethods); } if (OnCreate != null) { OnCreate.Invoke(context); } }
public virtual void Create(AuthenticationTokenCreateContext context) { if (OnCreateAsync != null && OnCreate == null) { throw new InvalidOperationException("Authentication token did not provide an OnCreate method."); } if (OnCreate != null) { OnCreate.Invoke(context); } }
private void Start() { UpdateView(); if (isInvisible) { SetVisible(false); // делаем полностью невидимым } OnCreate?.Invoke(isUnderstroyable); }
protected Component() { gameObject = new GameObject(); OnCreate += Component_OnCreate; OnEnable += Component_OnEnable; OnDisable += Component_OnDisable; OnDestroy += Component_OnDestroy; OnCreate.Invoke(this, true); Create(); }
private async Task <DrawerRef> HandleCreate(DrawerConfig config) { if (OnCreate != null) { config.DrawerService = this; await OnCreate.Invoke(config); DrawerRef drawerRef = new DrawerRef(config, this); return(drawerRef); } return(null); }
/// <summary>Initializes a new instance of the <see cref="GameObject" /> class.</summary> public GameObject() { name = "GameObject"; transform = new Transform(); components = new List <Component>(); OnCreate += GameObject_OnCreate; OnEnable += GameObject_OnEnable; OnDisable += GameObject_OnDisable; OnDestroy += GameObject_OnDestroy; OnCreate.Invoke(this, true); }
public T1 CreateObject <T1, T2>(T2 factory, params object[] args) where T1 : IPoolObject, new() where T2 : IFactory <T1> { int id = RecycleObject(); if (id == INVALID_ID) { id = GenerateObject <T1, T2>(factory, args); } OnCreate?.Invoke(id); return((T1)objects[id]); }
public async Task <T> Create(T resource) { await resource.OnCreate(); var created = await CreateItem(resource); if (ResourceHasEvent(ResourceEventType.Created)) { await SendEvent(() => OnCreate?.Invoke(this, created), async() => await DeleteItem(resource.Id), resource); } return(created); }
public T CreateObject <T>() where T : IPoolObject, new() { int id = RecycleObject(); if (id == INVALID_ID) { id = GenerateObject <T>(); } OnCreate?.Invoke(id); return((T)objects[id]); }
/// <summary>Initializes a new instance of the <see cref="GameObject" /> class.</summary> /// <param name="name">The name.</param> /// <param name="transform">The transform.</param> /// <exception cref="ArgumentNullException">name /// or /// transform</exception> public GameObject([NotNull] string name, [NotNull] Transform transform) { this.name = name; this.transform = transform; components = new List <Component>(); OnCreate += GameObject_OnCreate; OnEnable += GameObject_OnEnable; OnDisable += GameObject_OnDisable; OnDestroy += GameObject_OnDestroy; OnCreate.Invoke(this, true); }
// PUT NEW CLASSES HERE!!! // // // void client_UploadValuesCompleted(object sender, UploadValuesCompletedEventArgs e) { Activity.RunOnUiThread(() => { string id = Encoding.UTF8.GetString(e.Result); //Get the data echo backed from PHP int newID = 0; int.TryParse(id, out newID); //Cast the id to an integer //Broadcast event OnCreate.Invoke(this, new CreateContactEventArgs(newID, txtName.Text, txtNumber.Text)); this.Dismiss(); }); }
public GameObject([NotNull] string name, [NotNull] Transform transform, [NotNull] List <Component> components) { this.name = name; this.transform = transform; this.components = components; this.components.ForEach(i => i.AttachTo(this)); OnCreate += GameObject_OnCreate; OnEnable += GameObject_OnEnable; OnDisable += GameObject_OnDisable; OnDestroy += GameObject_OnDestroy; OnCreate.Invoke(this, true); }
public Transform([NotNull] Vector3 position, [NotNull] Vector3 rotation, [NotNull] Vector3 size) { this.position = position; this.rotation = rotation; this.size = size; OnCreate += Transform_OnCreate; OnPositionChange += Transform_OnPositionChange; OnRotationChange += Transform_OnRotationChange; OnSizeChange += Transform_OnSizeChange; OnDestroy += Transform_OnDestroy; OnCreate.Invoke(this, true); }
/// <summary>Initializes a new instance of the <see cref="Transform" /> class.</summary> /// <param name="position">The position.</param> public Transform([NotNull] Vector3 position) { this.position = position; rotation = new Vector3(0f); size = new Vector3(1f); OnCreate += Transform_OnCreate; OnPositionChange += Transform_OnPositionChange; OnRotationChange += Transform_OnRotationChange; OnSizeChange += Transform_OnSizeChange; OnDestroy += Transform_OnDestroy; OnCreate.Invoke(this, true); }
protected override void DoCreate() { lifeTime = data.range; rb.isKinematic = false; enabled = true; if (mesh != null) { mesh.SetActive(true); } trail.Clear(); trail.startWidth = 0.1f; trail.time = 1; destroyedCalled = false; OnCreate?.Invoke(); }