Inheritance: UnityEventBase
コード例 #1
0
 public static void InvokeEx(this UnityEngine.Events.UnityEvent a)
 {
     if (a != null)
     {
         a.Invoke();
     }
 }
コード例 #2
0
ファイル: EventTrigger2D.cs プロジェクト: almyu/ld33
    private void FilterAndInvoke(Collider2D collider, UnityEvent colliderEvent)
    {
        int mask = 1 << collider.gameObject.layer;
        if ((mask & filter.value) == 0) return;

        colliderEvent.Invoke();
    }
コード例 #3
0
 public override void EnterState(StateController controller)
 {
     transition = false;
     response   = new UnityEngine.Events.UnityEvent();
     response.AddListener(SetTrue);
     listenEvent.RegisterListener(response);
 }
コード例 #4
0
 public void UnregisterListener(UnityEngine.Events.UnityEvent _listener)
 {
     if (listener.Contains(_listener))
     {
         listener.Remove(_listener);
     }
 }
コード例 #5
0
ファイル: SetNoteManager.cs プロジェクト: CarolaC/CAVESound
    // Use this for initialization
    void Start()
    {
        if (setOnLoopEvent == null)
            setOnLoopEvent = new UnityEvent ();

        timeOut = 0;
    }
コード例 #6
0
 static int Invoke(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 1);
     UnityEngine.Events.UnityEvent obj = (UnityEngine.Events.UnityEvent)LuaScriptMgr.GetNetObjectSelf(L, 1, "UnityEngine.Events.UnityEvent");
     obj.Invoke();
     return(0);
 }
コード例 #7
0
        static Translator()
        {
            #if UNITY_EDITOR
            CodeGenerator.generate();
            #endif

            mLanguageChangedAction = new UnityEvent();

            mLoadedSections = new Dictionary<R.sections.SectionID, SectionTokens>();

            #region Initialize default tokens
            tokens    = new SectionTokens[(int)R.sections.SectionID.Count + 1];
            tokens[0] = new SectionTokens();

            string xmlFile                     = "strings.xml";
            Dictionary<string, int>[] tokenIds = R.tokenIds[0];
            int stringCount                    = tokenIds[0].Count;
            int stringArrayCount               = tokenIds[1].Count;
            int pluralsCount                   = tokenIds[2].Count;

            tokens[0].defaultLanguage = parseXmlTokens(xmlFile, "", tokenIds, stringCount, stringArrayCount, pluralsCount);
            #endregion

            #region Set language according to system language
            Language selectLanguage = LanguageSystemName.systemLanguageToLanguage(Application.systemLanguage);

            if (AvailableLanguages.list.ContainsKey(selectLanguage))
            {
                language = selectLanguage;
            }
            #endregion
        }
コード例 #8
0
 void Start()
 {
     if(OnEnter == null)
     {
         OnEnter = new UnityEvent();
     }
 }
コード例 #9
0
    static int RemoveListener(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UnityEngine.Events.UnityEvent <bool>  obj  = (UnityEngine.Events.UnityEvent <bool>)ToLua.CheckObject(L, 1, typeof(UnityEngine.Events.UnityEvent <bool>));
            UnityEngine.Events.UnityAction <bool> arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (UnityEngine.Events.UnityAction <bool>)ToLua.CheckObject(L, 2, typeof(UnityEngine.Events.UnityAction <bool>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(UnityEngine.Events.UnityAction <bool>), func) as UnityEngine.Events.UnityAction <bool>;
            }

            obj.RemoveListener(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #10
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.Events.UnityEvent o;
     o = new UnityEngine.Events.UnityEvent();
     pushObject(l, o);
     return(1);
 }
コード例 #11
0
 static public int RemoveListener(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Events.UnityEvent  self = (UnityEngine.Events.UnityEvent)checkSelf(l);
         UnityEngine.Events.UnityAction a1;
         checkDelegate(l, 2, out a1);
         self.RemoveListener(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #12
0
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Events.UnityEvent o;
         o = new UnityEngine.Events.UnityEvent();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #13
0
 public void RegisterListener(UnityEngine.Events.UnityEvent _listener)
 {
     if (!listener.Contains(_listener))
     {
         listener.Add(_listener);
     }
 }
コード例 #14
0
    // -----------------------------------------------------------------
    void Awake()
    {
        if (TriggerT == null)
            TriggerT = new UnityEvent ();

        if (TriggerE == null)
            TriggerE = new UnityEvent ();

        if (TriggerA == null)
            TriggerA = new UnityEvent ();

        if (TriggerM == null)
            TriggerM = new UnityEvent ();

        TriggerT.AddListener (() => {
            Debug.Log ("TriggerT");
        });
        TriggerE.AddListener (() => {
            Debug.Log ("TriggerE");
        });
        TriggerA.AddListener (() => {
            Debug.Log ("TriggerA");
        });
        TriggerM.AddListener (() => {
            Debug.Log ("TriggerM");
        });
    }
コード例 #15
0
    //Removes all listeners of an event, adds one listener, and then invokes the event depending on parameters
    public static void RemoveAllAndAddListener(UnityEvent e, UnityAction listenerToAdd, bool invoke)
    {
        e.RemoveAllListeners(); //Remove all listeners
        e.AddListener(listenerToAdd); //Add the listen

        if(invoke) //If the event should be invoked
            e.Invoke(); //Invoke all listeners
    }
コード例 #16
0
ファイル: SimulateRotation.cs プロジェクト: CarolaC/CAVESound
    // Use this for initialization
    void Start()
    {
        if (setOnLoopEvent == null)
            setOnLoopEvent = new UnityEvent ();

        rotateTo = Quaternion.Euler (new Vector3 (90, 0, 0));
        rotateBack = Quaternion.Euler (new Vector3 (0, 0, 0));
    }
コード例 #17
0
ファイル: EventBus.cs プロジェクト: catrmonte/EventQueue
 public static void StopListening(string eventName, UnityEngine.Events.UnityAction listener)
 {
     UnityEngine.Events.UnityEvent thisEvent = null;
     if (Instance.m_EventDictionary.TryGetValue(eventName, out thisEvent))
     {
         thisEvent.RemoveListener(listener);
     }
 }
コード例 #18
0
ファイル: EventBus.cs プロジェクト: catrmonte/EventQueue
 public static void TriggerEvent(string eventName)
 {
     UnityEngine.Events.UnityEvent thisEvent = null;
     if (Instance.m_EventDictionary.TryGetValue(eventName, out thisEvent))
     {
         thisEvent.Invoke();
     }
 }
コード例 #19
0
 public void PlayAudio(float duration)
 {
     audio.Play();
     UnityEngine.Events.UnityEvent  events = new UnityEngine.Events.UnityEvent();
     UnityEngine.Events.UnityAction action = new UnityEngine.Events.UnityAction(StopAudio);
     events.AddListener(action);
     Timer.Instance.AddNotification(duration, events, false);
 }
コード例 #20
0
    //Destoyed in HitArea class

    void Awake()
    {
        OnBattleEnd      = new UnityEngine.Events.UnityEvent();
        _targetCharacter = GameController.Instance.PlayerCharacter;
        _controlledEnemy = gameObject.GetComponent <Enemy>();
        ImpulseSource.m_ImpulseDefinition.m_TimeEnvelope.m_SustainTime = EnterSound.length * 0.75f;
        ImpulseSource.m_ImpulseDefinition.m_TimeEnvelope.m_DecayTime   = EnterSound.length * 0.25f;
    }
コード例 #21
0
ファイル: PopupMenu.cs プロジェクト: HaKDMoDz/UnityEditor
        /// <summary>
        /// Initializes a new instance of the <see cref="Common.UI.Popups.PopupMenu"/> class with specified menu items.
        /// </summary>
        /// <param name="items">Items.</param>
        public PopupMenu(TreeNode<CustomMenuItem> items)
        {
            mItems          = items;
            mGameObject     = null;
            mOnDestroy      = new UnityEvent();

            mChildPopupMenu = null;
        }
コード例 #22
0
 IEnumerator checkForKeyUp(KeyCode key, UnityEvent keyUpEvent)
 {
     while (alive) {
         if (Input.GetKeyUp(key) == true) {
             keyUpEvent.Invoke();
         }
         yield return null;
     }
 }
コード例 #23
0
		public static void Register(object handler, UnityEvent @event, System.Action action, bool callAction = true) {

			var item = new Item();
			item.action = action;
			item.unityEvent = @event;

			DelegateUtils.Register_INTERNAL(handler, item, callAction);

		}
コード例 #24
0
    // Use this for initialization
    void Start()
    {
        UnityEngine.Events.UnityEvent ue = new UnityEngine.Events.UnityEvent();
        ue.AddListener(() =>
        {
            Debug.Log(1);
            boss.talking   = false;
            player.talking = true;
        });
        UnityEngine.Events.UnityEvent ue2 = new UnityEngine.Events.UnityEvent();
        ue2.AddListener(() =>
        {
            Debug.Log(2);
            boss.talking   = true;
            player.talking = false;
        });

        for (int i = 0; i < 2; ++i)
        {
            dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
            dialogTree.Current.DelegatePointer.Function = ue;
            dialogTree.MoveDown(0);
            dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
            dialogTree.Current.DelegatePointer.Function = ue2;
            dialogTree.MoveDown(0);
        }
        dialogTree.MoveDown(0);
        for (int i = 0; i < 2; ++i)
        {
            dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
            dialogTree.Current.DelegatePointer.Function = ue;
            dialogTree.MoveDown(0);
            dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
            dialogTree.Current.DelegatePointer.Function = ue2;
            dialogTree.MoveDown(0);
        }
        dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
        dialogTree.Current.DelegatePointer.Function = ue;
        dialogTree.MoveDown(0);
        //dialogTree.MoveDown(0);

        for (int i = 0; i < 2; ++i)
        {
            dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
            dialogTree.Current.DelegatePointer.Function = ue;
            dialogTree.MoveDown(0);
            dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
            dialogTree.Current.DelegatePointer.Function = ue2;
            dialogTree.MoveDown(0);
        }
        dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
        dialogTree.Current.DelegatePointer.Function = ue;
        dialogTree.MoveDown(0);
        dialogTree.Current.DelegatePointer          = DelegatePointer.CreateInstance <DelegatePointer>();
        dialogTree.Current.DelegatePointer.Function = new UnityEngine.Events.UnityEvent();
        dialogTree.Current.DelegatePointer.Function.AddListener(() => { Enable.SetActive(true); Disable.SetActive(false); });
    }
コード例 #25
0
ファイル: EventManager.cs プロジェクト: Mystraht/rush
 public static void StartListening(string eventName, UnityAction listener) {
     UnityEvent thisEvent = null;
     if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) {
         thisEvent.AddListener(listener);
     } else {
         thisEvent = new UnityEvent();
         thisEvent.AddListener(listener);
         instance.eventDictionary.Add(eventName, thisEvent);
     }
 }
コード例 #26
0
ファイル: CrusadeQuest.cs プロジェクト: 10123815/Diabloo
 public override void Claim( )
 {
     // listen to the QuestManager to get the quest completion evet
     if (!QuestManager.enemyDeathEvents.ContainsKey(dogID))
     {
         UnityEvent checkEvent = new UnityEvent();
         QuestManager.enemyDeathEvents.Add(dogID, checkEvent);
     }
     QuestManager.enemyDeathEvents[dogID].AddListener(this.CheckCompletionEventHandler);
 }
コード例 #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Common.UI.Popups.PopupMenu"/> class with specified menu items.
        /// </summary>
        /// <param name="items">Items.</param>
        public PopupMenu(TreeNode<CustomMenuItem> items)
        {
            DebugEx.VerboseFormat("Created PopupMenu(items = {0}) object", items);

            mItems     = items;
            mOnDestroy = new UnityEvent();

            mGameObject     = null;
            mChildPopupMenu = null;
        }
コード例 #28
0
 static public int Invoke(IntPtr l)
 {
     try {
         UnityEngine.Events.UnityEvent self = (UnityEngine.Events.UnityEvent)checkSelf(l);
         self.Invoke();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #29
0
 public static void StartListening(string eventname, UnityAction listener)
 {
     UnityEvent evt = null;
     if (mEMInstance.mEventDictionary.TryGetValue (eventname, out evt)) {
         evt.AddListener (listener);
     } else {
         evt = new UnityEvent();
         evt.AddListener(listener);
         mEMInstance.mEventDictionary.Add(eventname, evt);
     }
 }
コード例 #30
0
    private void EventToStream()
    {
        MyEvent = new UnityEngine.Events.UnityEvent();

        MyEvent
        .AsObservable()
        .Subscribe(_ => Debug.Log("Event Call"));

        MyEvent.Invoke();
        MyEvent.Invoke();
    }
コード例 #31
0
	/// <summary>
	/// Subscribe to an event.
	/// </summary>
	public static void Subscribe(string eventName, UnityAction listener)
	{
		UnityEvent thisEvent = null;

		if (!instance.m_events.TryGetValue(eventName, out thisEvent)) {
			thisEvent = new UnityEvent();
			instance.m_events.Add(eventName, thisEvent);
		}

		thisEvent.AddListener(listener);
	}
コード例 #32
0
ファイル: EventBus.cs プロジェクト: vpmedia/template-unity
 // ================================================================================
 // Public Methods
 // ================================================================================
 /// <summary>
 /// Adds a listener to a UnityEvent
 /// </summary>
 /// <param name="eventName">the event to listen for</param>
 /// <param name="listener">the callback to call</param>
 /// <returns></returns>
 public void Add(string eventName, UnityAction listener)
 {
     UnityEvent thisEvent = null;
     if (eventDictionary.TryGetValue (eventName, out thisEvent)) {
         thisEvent.AddListener (listener);
     } else {
         thisEvent = new UnityEvent ();
         thisEvent.AddListener (listener);
         eventDictionary.Add (eventName, thisEvent);
     }
 }
コード例 #33
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Events.UnityEvent o;
         o = new UnityEngine.Events.UnityEvent();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #34
0
 /// <summary>
 /// カード情報を初期化設定するための関数
 /// </summary>
 /// <param name="nameText"></param>商品名
 /// <param name="effectText"></param>カードの効果説明
 /// <param name="maxStock"></param>カードの在庫数
 /// <param name="effect"></param>カードの効果を記述したクラス
 /// <param name="tex"></param>アイコン画像
 public void CardInitialize(string nameText, string effectText, int maxStock, UnityEngine.Events.UnityEvent effect, Sprite tex,
                            float firstSellInADay, float firstAmountOfIncrease, float firstAmountOfDecrease)
 {
     this.SetNameText(nameText);
     this.SetCardEffectText(effectText);
     this.SetMaxStock(maxStock);
     this.SetCardEffect(effect);
     this.SetCardIconImage(tex);
     this.SetSellInADay(firstSellInADay);
     this.SetAmountOfIncrease(firstAmountOfIncrease);
     this.SetAmountOfDecrease(firstAmountOfDecrease);
 }
コード例 #35
0
 static public int Invoke(IntPtr l)
 {
     try{
         UnityEngine.Events.UnityEvent self = (UnityEngine.Events.UnityEvent)checkSelf(l);
         self.Invoke();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #36
0
    void Start()
    {
        if (myEvent == null)
            myEvent = new UnityEvent();

        words = GetComponent<Text>().text;
        GetComponent<Text>().text = string.Empty;
        timer = 0;
        isActive = true;
        charsPerSecond = Mathf.Max(1, charsPerSecond);
        mText = GetComponent<Text>();
    }
コード例 #37
0
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.Events.UnityEvent o;
			o=new UnityEngine.Events.UnityEvent();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
コード例 #38
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.Events.UnityEvent o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.Events.UnityEvent();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
コード例 #39
0
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.Events.UnityEvent o;
         o=new UnityEngine.Events.UnityEvent();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
コード例 #40
0
    // Use this for initialization
    void Start () {
        aiScript = GetComponent<AICarTrackFollowing>();
        hfsmp = new HStateMachineParent();
        hfsmp.newMachine(new RACING());
        hfsmp.newMachine(new OBSTACLE_AVOID());
        hfsmp.newMachine(new CAR_HIT());
        hfsmp.init();

        if (changeState == null)
            changeState = new UnityEvent();

        changeState.AddListener(changeEvent);
    }
コード例 #41
0
 static int QPYX_Invoke_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.Events.UnityEvent QPYX_obj_YXQP = (UnityEngine.Events.UnityEvent)ToLua.CheckObject <UnityEngine.Events.UnityEvent>(L_YXQP, 1);
         QPYX_obj_YXQP.Invoke();
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #42
0
 static public int RemoveListener(IntPtr l)
 {
     try {
         UnityEngine.Events.UnityEvent  self = (UnityEngine.Events.UnityEvent)checkSelf(l);
         UnityEngine.Events.UnityAction a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         self.RemoveListener(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #43
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Events.UnityEvent o;
         o = new UnityEngine.Events.UnityEvent();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #44
0
    protected IfEvent UnityEvent2IfEvent(UnityEngine.Events.UnityEvent e)
    {
        object target = e.GetPersistentTarget(0);
        Type   t      = target.GetType();

        System.Reflection.MethodInfo mi = t.GetMethod(e.GetPersistentMethodName(0));
        IfEvent ie = () => {
            object o = mi.Invoke(target, new object[] {});
            return((bool)o);
        };

        return(ie);
    }
コード例 #45
0
ファイル: UICanvasScript.cs プロジェクト: Clpsplug/ggjsap2016
	// Use this for initialization
	void Start () {
		// コールバック用変数生成
		myEvent = new UnityEvent();

		items.AddRange(itemArray);

		// お供え消す
		showDedicate (false);

		// HPセット
		setHp(100,100);

		showItems();
	}
コード例 #46
0
ファイル: EventManager.cs プロジェクト: Charnock/Space
 // Adds a listener to an event
 // The callback is a void return, zero arguement function
 public static void AddEventListener( string eventName, UnityAction callback )
 {
     UnityEvent thisEvent = null;
     if ( Instance.eventDictionary.TryGetValue ( eventName, out thisEvent ) )
     {
         thisEvent.AddListener ( callback );
     }
     else
     {
         thisEvent = new UnityEvent();
         thisEvent.AddListener( callback );
         ms_instance.eventDictionary.Add( eventName, thisEvent );
     }
 }
コード例 #47
0
 static int Invoke(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.Events.UnityEvent obj = (UnityEngine.Events.UnityEvent)ToLua.CheckObject(L, 1, typeof(UnityEngine.Events.UnityEvent));
         obj.Invoke();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int QPYX_Invoke_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.Events.UnityEvent <float> QPYX_obj_YXQP = (UnityEngine.Events.UnityEvent <float>)ToLua.CheckObject <UnityEngine.Events.UnityEvent <float> >(L_YXQP, 1);
         float QPYX_arg0_YXQP = (float)LuaDLL.luaL_checknumber(L_YXQP, 2);
         QPYX_obj_YXQP.Invoke(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #49
0
 static public int AddListener(IntPtr l)
 {
     try{
         UnityEngine.Events.UnityEvent  self = (UnityEngine.Events.UnityEvent)checkSelf(l);
         UnityEngine.Events.UnityAction a1;
         checkDelegate(l, 2, out a1);
         self.AddListener(a1);
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #50
0
 static public int AddListener(IntPtr l)
 {
     try {
         UnityEngine.Events.UnityEvent  self = (UnityEngine.Events.UnityEvent)checkSelf(l);
         UnityEngine.Events.UnityAction a1;
         checkDelegate(l, 2, out a1);
         self.AddListener(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #51
0
 static int QPYX_RemoveListener_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.Events.UnityEvent <string>  QPYX_obj_YXQP  = (UnityEngine.Events.UnityEvent <string>)ToLua.CheckObject <UnityEngine.Events.UnityEvent <string> >(L_YXQP, 1);
         UnityEngine.Events.UnityAction <string> QPYX_arg0_YXQP = (UnityEngine.Events.UnityAction <string>)ToLua.CheckDelegate <UnityEngine.Events.UnityAction <string> >(L_YXQP, 2);
         QPYX_obj_YXQP.RemoveListener(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #52
0
 static int QPYX_Invoke_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.Events.UnityEvent <string> QPYX_obj_YXQP = (UnityEngine.Events.UnityEvent <string>)ToLua.CheckObject <UnityEngine.Events.UnityEvent <string> >(L_YXQP, 1);
         string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
         QPYX_obj_YXQP.Invoke(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #53
0
        void OnDestroy()
        {
            alive = false;

            onMouseButtonLeftUpEvent.RemoveAllListeners();
            onMouseButtonLeftUpEvent = null;

            onMouseButtonLeftDownEvent.RemoveAllListeners();
            onMouseButtonLeftDownEvent = null;

            onMouseButtonRightUpEvent.RemoveAllListeners();
            onMouseButtonRightUpEvent = null;

            onMouseButtonRightDownEvent.RemoveAllListeners();
            onMouseButtonRightDownEvent = null;
        }
コード例 #54
0
ファイル: EventBus.cs プロジェクト: vpmedia/template-unity
 /// <summary>
 /// Adds a listener to a UnityEvent which is removed as soon as the event is dispatched
 /// </summary>
 /// <param name="eventName">the event to listen for</param>
 /// <param name="listener">the callback to call</param>
 /// <returns></returns>
 public void AddOnce(string eventName, UnityAction listener)
 {
     UnityEvent thisEvent = null;
     UnityAction onceListener = null;
     onceListener = () =>
     {
         thisEvent.RemoveListener (onceListener);
         listener ();
     };
     if (eventDictionary.TryGetValue (eventName, out thisEvent)) {
         thisEvent.AddListener (onceListener);
     } else {
         thisEvent = new UnityEvent ();
         thisEvent.AddListener (onceListener);
         eventDictionary.Add (eventName, thisEvent);
     }
 }
コード例 #55
0
        /// <summary>
        /// Script starting callback.
        /// </summary>
        void Start()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                Debug.LogError("Two instances of ResizeListenerScript not supported");
            }

            mScreenWidth  = Screen.width;
            mScreenHeight = Screen.height;
            mDelay        = CHECK_INTERVAL;

            mListeners = new UnityEvent();
        }
コード例 #56
0
ファイル: Event.cs プロジェクト: muit/CrabFramework
        public static void RenderConnection(MonoBehaviour caster, UnityEvent ev)
        {
            Color gizmosColor = Gizmos.color;
            for (int i = 0, len = ev.GetPersistentEventCount(); i < len; i++)
            {
                Event target = ev.GetPersistentTarget(i) as Event;
                if (target)
                {
                    string method = ev.GetPersistentMethodName(i);
                    if (method == "StartEvent")
                        Gizmos.color = Color.green;
                    else if (method == "set_enabled")
                        Gizmos.color = Color.blue;
                    else
                        return;

                    Gizmos.DrawLine(caster.transform.position, target.transform.position);
                }
            }
            Gizmos.color = gizmosColor;
        }
コード例 #57
0
    void Awake()
    {
        if (self == null)
            self = this;
        else
            Destroy (gameObject);

        m_ScoreCallback = new UnityEvent ();

        for (int i = 0; i < m_CoinCount; ++i)
        {
            Instantiate (
                m_CoinPrefab,
                new Vector3(
                    Random.Range(m_CoinMinPosition.x, m_CoinMaxPosition.x),
                    Random.Range(m_CoinMinPosition.y, m_CoinMaxPosition.y),
                    Random.Range(m_CoinMinPosition.z, m_CoinMaxPosition.z)),
                Quaternion.identity);
        }

        for (int i = 0; i < m_ObstacleCount; ++i)
        {
            ObstacleController newObstacle = Instantiate (
                m_ObstaclePrefab,
                new Vector3 (
                    Random.Range (m_ObstacleMinPosition.x, m_ObstacleMaxPosition.x),
                    Random.Range (m_ObstacleMinPosition.y, m_ObstacleMaxPosition.y),
                    Random.Range (m_ObstacleMinPosition.z, m_ObstacleMaxPosition.z)),
                Quaternion.identity) as ObstacleController;

            int randomDirection = Random.Range (1, 4);

            newObstacle.minPosition = m_ObstacleMinPosition;
            newObstacle.maxPosition = m_ObstacleMaxPosition;

            switch (randomDirection)
            {
            case 1:
                newObstacle.speed = new Vector3(Random.Range(1, newObstacle.speed.x), 0f, 0f);
                break;
            case 2:
                newObstacle.speed = new Vector3(0f, Random.Range(1, newObstacle.speed.y), 0f);
                break;
            case 3:
                newObstacle.speed = new Vector3(0f, 0f, Random.Range(1, newObstacle.speed.z));
                break;
            }
        }

        m_WinText.gameObject.SetActive(false);
    }
コード例 #58
0
ファイル: TransformBase.cs プロジェクト: arahis/Swiper
    protected virtual void AddEvents()
    {
        //Debug.LogError("ADD EVENTS BASE");

        Tween.SetEase(Ease);

        if (IsLoop)
        {
            Tween.SetLoops(Loops, LoopType);
        }

        if (StartEvent == null)
        {
            StartEvent = new UnityEvent();
        }
        Tween.OnStart(() => { StartEvent.Invoke(); });

        if (PlayEvent == null)
        {
            PlayEvent = new UnityEvent();
        }
        Tween.OnPlay(() => { PlayEvent.Invoke(); });

        if (StepCompleteEvent == null)
        {
            StepCompleteEvent = new UnityEvent();
        }
        Tween.OnStepComplete(() => { StepCompleteEvent.Invoke(); });

        if (UpdateEvent == null)
        {
            UpdateEvent = new UnityEvent();
        }
        Tween.OnUpdate(() => { UpdateEvent.Invoke(); });

        if (PauseEvent == null)
        {
            PauseEvent = new UnityEvent();
        }
        Tween.OnPause(() => { PauseEvent.Invoke(); });

        if (KillEvent == null)
        {
            KillEvent = new UnityEvent();
        }
        Tween.OnKill(() => { KillEvent.Invoke(); });

        if (CompleteEvent == null)
        {
            CompleteEvent = new UnityEvent();
        }
        Tween.OnComplete(() => { CompleteEvent.Invoke(); });

        if (RewindEvent == null)
        {
            RewindEvent = new UnityEvent();
        }
        Tween.OnRewind(() => { RewindEvent.Invoke(); });
    }
コード例 #59
0
ファイル: UIUnitFrame_Bar.cs プロジェクト: Daloupe/Syzygy_Git
 protected void Reset()
 {
     this.m_TargetTransform = this.transform as RectTransform;
     this.m_OnChange = new UnityEvent();
 }
	public ActionWrapper(UnityEvent evn){
		act = evn.Invoke;
	}