예제 #1
0
 public View(string name, object control, string caption, OnClosingDelegate onClosingHandler, ActivateDelegate onActivateHandler, BooleanDelegate canCloseHandler, string hint, Image image, ViewDockingState dockingState, ViewDockingStateFlagExt allowDockingStates)
     : base(name, control, caption, hint, image)
 {
     _onCloseHandler    = onClosingHandler;
     _canCloseHandler   = canCloseHandler;
     _onActivateHandler = onActivateHandler;
 }
예제 #2
0
    public NetworkInstantiatePool(GameObject prefab, int size, ActivateDelegate activate, PrefabInitDelegate prefabInitDelegate)
    {
        Prefab = prefab.GetComponent <uLink.NetworkView>();

        if (null != prefabInitDelegate)
        {
            prefabInitDelegate(prefab);
        }

        MaxSize = size;

        if (Prefab._manualViewID != 0)
        {
            Debug.LogError("Prefab viewID must be set to Allocated or Unassigned", Prefab);
            return;
        }

        Parent = new GameObject("_" + Prefab.name + "-Pool").transform;

        GameObject.DontDestroyOnLoad(Parent);

        for (int i = 0; i < size; i++)
        {
            uLink.NetworkView instance = (uLink.NetworkView)Object.Instantiate(Prefab);
            instance.transform.parent = Parent;
            instance.gameObject.SetActive(false);
            GameObject.DontDestroyOnLoad(instance.gameObject);

            Pool.Push(instance);
        }

        Activate = activate;

        uLink.NetworkInstantiator.Add(Prefab.name, Creator, Destroyer);
    }
예제 #3
0
 void dockManager_DockItemActivating(object sender, ItemCancelEventArgs e)
 {
     if (e.Item.Name == "newNote")
     {
         DocumentPanel panel = CreateNewNote();
         e.Cancel = panel != null;
         if (panel != null)
         {
             ActivateDelegate activate = new ActivateDelegate(ActivateDockItem);
             Dispatcher.BeginInvoke(activate, new object[] { panel });
         }
     }
 }
예제 #4
0
 void dockManager_LayoutItemActivating(object sender, ItemCancelEventArgs e)
 {
     if (e.Item.Name == "newNotePage")
     {
         LayoutControlItem item = CreateNewNotePage(e.Item.Parent);
         e.Cancel = item != null;
         if (item != null)
         {
             ActivateDelegate activate = new ActivateDelegate(ActivateLayoutItem);
             Dispatcher.BeginInvoke(activate, new object[] { item });
         }
     }
 }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Util.ObjectPool"/> class.
        /// </summary>
        /// <param name='prefab'>
        /// GameObject Prefab to instantiate objects.
        /// </param>
        /// <param name='initialSize'>
        /// Initial size of the pool.
        /// </param>
        /// <param name='setActiveRecursively'>
        /// to call SetActiveRecursively or .active
        /// </param>
        /// <param name='onActivate'>
        /// Delegate to call when object is spawned
        /// </param>
        /// <param name='onDeactivate'>
        /// Delegate to call when object is recycled
        /// </param>
        public ObjectPool(GameObject prefab, Transform parent, int initialSize, bool setActiveRecursively, ActivateDelegate onActivate = null, DeactivateDelegate onDeactivate = null)
        {
            m_Prefab = prefab;
            m_SetActiveRecursively = setActiveRecursively;
            OnActivate             = onActivate;
            OnDeactivate           = onDeactivate;
            m_PoolActive           = new List <GameObject>();
            m_PoolAvailable        = new List <GameObject>();

            for (int i = 0; i < initialSize; ++i)
            {
                GameObject gameObject = GameObject.Instantiate(m_Prefab) as GameObject;
                m_PoolAvailable.Add(gameObject);
                gameObject.transform.SetParent(parent);
                SetActive(gameObject, false);
            }
        }
예제 #6
0
 /// <summary>
 /// Change OnActivate method
 /// </summary>
 /// <param name='_onActivate'>
 /// delegate method
 /// </param>
 public void SetOnActivateMethod(ActivateDelegate _onActivate)
 {
     OnActivate = _onActivate;
 }
예제 #7
0
 public Action()
 {
     this.CanActivate = null;
     this.Activate    = null;
     this.EnergyCost  = 0;
 }
예제 #8
0
 public Action(ConditionDelegate CanActivate, ActivateDelegate Activate, float EnergyCost)
 {
     this.CanActivate = CanActivate;
     this.Activate    = Activate;
     this.EnergyCost  = EnergyCost;
 }
예제 #9
0
 public static extern void _UnityJS_HandleAwake(ActivateDelegate activateCallback);
예제 #10
0
 public View(object control, string caption, OnClosingDelegate onClosingHandler, ActivateDelegate onActivateHandler)
     : this(string.Empty, control, caption, onClosingHandler, onActivateHandler, null, string.Empty, null, ViewDockingState.Right, ViewDockingStateHelper.All)
 {
 }