// 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"); }
void Awake() { NotificationCenter notificationCenter = NotificationCenter.DefaultCenter(); notificationCenter.AddObserver(this, "QuitScene"); notificationCenter.AddObserver(this, "OnDead"); }
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); }
// 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; }
// 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); }
// 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); }) ); }
// Use this for initialization void Start() { if (playerEvent == null) { return; } UpdateEquipment(); NotificationCenter.AddObserver(this, Constants.OnUpdateEvents); }
// 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); }
void Start() { NotificationCenter.AddObserver(this, Constants.OnUpdateFeedDone); }
void Start() { NotificationCenter.AddObserver(this, Constants.OnTakeDamage); }
void Start() { NotificationCenter.AddObserver(this, Constants.OnRenderEvents); }
void Awake() { NotificationCenter.AddObserver() }
// Use this for initialization void Start() { Display(); NotificationCenter.AddObserver(this, Constants.OnUpdateAttribute); }
// Use this for initialization void Start() { NotificationCenter.AddObserver(this, Constants.OnEnvironmentUpdate); }
void Awake() { NotificationCenter.AddObserver(Jump, Notification.AnyKey); }
public static void AddObserver(this object obj, Handler handler, string notificationName, object sender) { NotificationCenter.AddObserver(handler, notificationName, sender); }
void Awake() { NotificationCenter.AddObserver(this, Constants.OnFirstPull); }
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); }
private void Awake() { NotificationCenter.AddObserver(LogController.EventRequestFrameData, OnRequestFrameData); NotificationCenter.AddObserver(LogController.EventRequestGameData, OnRequestGameData); }