Exemplo n.º 1
0
        // Use this for initialization
        void Start()
        {
            MainMediator mainMediator = new MainMediator();
            UserMediator userMediator = new UserMediator();

            NotificationCenter nc = NotificationCenter.GetInstance();

            // 测试AddObserver
            nc.AddObserver(mainMediator, "ShowSkillPanel");
            nc.AddObserver(userMediator, "LoginSucess");
            nc.AddObserver(userMediator, "Register");
            nc.AddObserver(mainMediator, "LoginSucess");
            // 查看Observers
            nc.ViewObserver();
            // 测试RemoveObserver
            //nc.RemoveObserver( userMediator , "LoginSucess" );
            //nc.RemoveObserver( mainMediator, "LoginSucess" );
            // 查看Observers
            return;

            nc.ViewObserver();
            print("SendNotification( Register  )");
            nc.SendNotification("Register2");
            print("SendNotification( LoginSucess)");
            nc.SendNotification("LoginSucess");
            mainMediator = null;
            nc.RemoveObserver(userMediator, "LoginSucess");
            nc.ViewObserver();
            print("SendNotification( LoginSucess)");
            nc.SendNotification("LoginSucess");
        }
Exemplo n.º 2
0
    void Awake()
    {
        NotificationCenter notificationCenter = NotificationCenter.DefaultCenter();

        notificationCenter.AddObserver(this, "QuitScene");
        notificationCenter.AddObserver(this, "OnDead");
    }
Exemplo n.º 3
0
    private Rect defaultRect;  //default rect size

    // Use this for initialization
    void Awake()
    {
        NotificationCenter notificationCenter = NotificationCenter.DefaultCenter();

        notificationCenter.AddObserver(this, "OnPause");
        notificationCenter.AddObserver(this, "OnDead");
        notificationCenter.AddObserver(this, "OnResume");

        mainCamera  = Camera.main.camera;
        defaultRect = mainCamera.rect;
        pausedRect  = new Rect(0f, 0.2f, 0.8f, 1f);
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        if (playerEvent == null)
        {
            return;
        }

        //leftActionConfirmation = null;
        //rightActionConfirmation = null;

        NotificationCenter.AddObserver(this, Constants.OnUpdateEvents);
        title.text = playerEvent.Content;

        AssignChoice(playerEvent.firstChoice);
        AssignChoice(playerEvent.secondChoice);

        leftActionView.actionName  = rightChoice.key;
        rightActionView.actionName = leftChoice.key;

        pullLeftLabel.text  = leftChoice.label;
        pullRightLabel.text = rightChoice.label;

        originalPullLeftSprite  = pullLeftIcon.sprite;
        originalPullRightSprite = pullRightIcon.sprite;
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        text = GetComponent <Text>();
        Display();

        NotificationCenter.AddObserver(this, Constants.OnUpdateAttribute);
    }
    private static int AddObserver(IntPtr L)
    {
        switch (LuaDLL.lua_gettop(L))
        {
        case 3:
        {
            NotificationCenter center    = (NotificationCenter)LuaScriptMgr.GetUnityObjectSelf(L, 1, "com.tencent.pandora.NotificationCenter");
            Component          observer  = (Component)LuaScriptMgr.GetUnityObject(L, 2, typeof(Component));
            string             luaString = LuaScriptMgr.GetLuaString(L, 3);
            center.AddObserver(observer, luaString);
            return(0);
        }

        case 4:
        {
            NotificationCenter center2    = (NotificationCenter)LuaScriptMgr.GetUnityObjectSelf(L, 1, "com.tencent.pandora.NotificationCenter");
            Component          component2 = (Component)LuaScriptMgr.GetUnityObject(L, 2, typeof(Component));
            string             name       = LuaScriptMgr.GetLuaString(L, 3);
            Component          sender     = (Component)LuaScriptMgr.GetUnityObject(L, 4, typeof(Component));
            center2.AddObserver(component2, name, sender);
            return(0);
        }
        }
        LuaDLL.luaL_error(L, "invalid arguments to method: com.tencent.pandora.NotificationCenter.AddObserver");
        return(0);
    }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     pullAnchorTitle      = pullAnchor.transform.Find("Title").GetComponent <Text>();
     pullAnchorTitle.text = pullAnchorDefaultText;
     NotificationCenter.AddObserver(this, Constants.OnUpdateEvents);
     NotificationCenter.AddObserver(this, Constants.OnUpdateFeed);
 }
        public override void ViewWillAppear()
        {
            base.ViewWillAppear();

            Disposables.Add(
                NotificationCenter.AddObserver(TreeControllerObservation.Name, notification => {
                HandleSelectionChange(notification);
            })
                );
        }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        if (playerEvent == null)
        {
            return;
        }

        UpdateEquipment();
        NotificationCenter.AddObserver(this, Constants.OnUpdateEvents);
    }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        waveSpawner = FindObjectOfType <WaveSpawnerTwo>();
        handAnimation["Squeeze"].enabled = true;
        handAnimation["Squeeze"].weight  = 1f;
        handAnimation["Squeeze"].time    = handAnimation["Squeeze"].length;
        handAnimation["Squeeze"].speed   = 0f;
        if (!useController)
        {
            UDPInputController.Instance.OnInput += OnInputReceived;
        }

        if ((GameValues.AutoMoveY || GameValues.AutoMoveX) && GameValues.AutoGrab)
        {
            useStick = false;
        }

        //Jildert logging
        NotificationCenter.AddObserver(LogController.EventRequestFrameData, OnRequestFrameData);
    }
Exemplo n.º 11
0
 void Start()
 {
     NotificationCenter.AddObserver(this, Constants.OnUpdateFeedDone);
 }
Exemplo n.º 12
0
 void Start()
 {
     NotificationCenter.AddObserver(this, Constants.OnTakeDamage);
 }
Exemplo n.º 13
0
 void Start()
 {
     NotificationCenter.AddObserver(this, Constants.OnRenderEvents);
 }
Exemplo n.º 14
0
 void Awake()
 {
     NotificationCenter.AddObserver()
 }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     Display();
     NotificationCenter.AddObserver(this, Constants.OnUpdateAttribute);
 }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     NotificationCenter.AddObserver(this, Constants.OnEnvironmentUpdate);
 }
Exemplo n.º 17
0
 void Awake()
 {
     NotificationCenter.AddObserver(Jump, Notification.AnyKey);
 }
Exemplo n.º 18
0
 public static void AddObserver(this object obj, Handler handler, string notificationName, object sender)
 {
     NotificationCenter.AddObserver(handler, notificationName, sender);
 }
Exemplo n.º 19
0
 void Awake()
 {
     NotificationCenter.AddObserver(this, Constants.OnFirstPull);
 }
Exemplo n.º 20
0
 void Awake()
 {
     //Starts listening for the posting of any notifications with the Anykey name. Will call "JumpNow" if one such is posted
     NotificationCenter.AddObserver((Action <int>)JumpNow, Notification.AnyKey);
 }
Exemplo n.º 21
0
 private void Awake()
 {
     NotificationCenter.AddObserver(LogController.EventRequestFrameData, OnRequestFrameData);
     NotificationCenter.AddObserver(LogController.EventRequestGameData, OnRequestGameData);
 }