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); }
public void Execute(World world) { OnReplace?.Invoke(world); OnRemove?.Invoke(world); OnCreate?.Invoke(world); OnSeed?.Invoke(world); }
virtual public void Clear() { assetBundlePath = null; assetName = null;//prefab name assetBundle = null; onCreate = null; }
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); } }
//----------------------------------------// //----- 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); } } }
/// <summary> /// 异步创建 /// </summary> /// <param name="assetName">Asset name.</param> /// <param name="onCreate">On create.</param> public void CreateAsync(string assetName, OnCreate onCreate) { //当前创建器为空 if (curAssetCreator == null) { curAssetCreator = objAssembly.CreateInstance(curAssetCreatorClass) as AssetCreatorBase; curAssetCreator.assetName = assetName; curAssetCreator.onCreate = onCreate; curAssetCreator.LoadAsset(); //StartCoroutine(curAssetCreator.LoadAssetAsync(assetBundle, curAssetCreator.assetName)); } //同名资源追加 回调方法, 当前创建器 assetName else if (curAssetCreator.assetName.Equals(assetName)) { curAssetCreator.onCreate += onCreate; } //检查当前创建器等待队列 else if (assetLoadingTable.ContainsKey(assetName)) { (assetLoadingTable[assetName] as AssetCreatorBase).onCreate += onCreate; } else { //新创建加载器 //AssetCreatorBase assetCreator = new AssetCreator(); AssetCreatorBase assetCreator = objAssembly.CreateInstance(curAssetCreatorClass) as AssetCreatorBase; assetCreator.assetName = assetName; assetCreator.assetBundle = null; assetCreator.onCreate = onCreate; //加入等待队列 assetLoading.Enqueue(assetCreator); //加入等待队列映射 assetLoadingTable.Add(assetCreator.assetName, assetCreator); } }
protected virtual T CreateNew() { var result = _createFunc.Invoke(); OnCreate?.Invoke(result); return(result); }
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); }
private static void GameObjectOnCreate(GameObject sender, EventArgs args) { var obj = sender as T; if (obj != null) { OnCreate?.Invoke(null, obj); } }
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); }
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 Cached( OnCreate onCreate, CachedOnCreateCallMode callMode = CachedOnCreateCallMode.SingleThread, OnEvict onEvict = null ) { _onCreate = onCreate ?? throw new ArgumentNullException(nameof(onCreate)); _callMode = callMode; _onEvict = onEvict; }
private void Start() { UpdateView(); if (isInvisible) { blockCollider = GetComponent <Collider2D>(); SetAccessible(false); } OnCreate?.Invoke(isUnderstroyable); }
public void SetFile(string s, OnCreate onCreate) { _path = s; AssetPath = _path; _name = Path.GetFileNameWithoutExtension(_path); _onCreate = onCreate; OnWizardUpdate(); }
/// <summary> Events callback. Called whenever said event is published by the mediator. </summary> /// <param name="eventArgs"> the event arguments </param> protected sealed override void OnEvent(TEvent eventArgs) { if (!ShouldCreate(eventArgs)) { return; } T instance = Create(eventArgs); OnCreate.SafeInvoke(instance, eventArgs); }
/// <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 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 static void MonitorDir(string path, OnCreate OnCreated) { FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = path; watcher.IncludeSubdirectories = true; var handler = new FileSystemEventHandler(OnCreated); watcher.Created += handler; watcher.EnableRaisingEvents = true; }
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); }
/// <summary> /// Creates from cache. /// </summary> /// <returns>The from cache.</returns> /// <param name="assetName">Asset name. 不带后缀区分大大小写 或 Asset全路径 </param> /// <param name="onCreate">On create.</param> public void CreateFromCache(string assetName, OnCreate onCreate) { Object gotp = null; assetPrefabDic.TryGetValue(assetName, out gotp); if (gotp) { onCreate(assetName, gotp); return; } CreateAsync(assetName, onCreate); }
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); }
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 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 T CreateObject <T>() where T : IPoolObject, new() { int id = RecycleObject(); if (id == INVALID_ID) { id = GenerateObject <T>(); } OnCreate?.Invoke(id); return((T)objects[id]); }