123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using Sfs2X;
- using Sfs2X.Requests;
- using UnityEngine;
- public class CounterAction
- {
- public int Count;
- public int Counter;
- public Action Action;
- public CounterAction(Action action, int count = 1)
- {
- Count = count;
- Action = action;
- }
- public void Invoke()
- {
- if (Counter++ < Count)
- {
- Action.Invoke();
- }
- }
- public void Bind(ref Action parent)
- {
- parent += Invoke;
- }
- }
- public class CounterAction<T>
- {
- public int Count;
- public int Counter;
- public Action<T> Action;
- public CounterAction(Action<T> action, int count = 1)
- {
- Count = count;
- Action = action;
- }
- public void Invoke(T t)
- {
- if (Counter++ < Count)
- {
- Action.Invoke(t);
- }
- }
- public void Bind(ref Action<T> parent)
- {
- parent += Invoke;
- }
- }
- public class CounterAction<T1, T2>
- {
- public int Count;
- public int Counter;
- public Action<T1, T2> Action;
- public CounterAction(Action<T1, T2> action, int count = 1)
- {
- Count = count;
- Action = action;
- }
- public void Invoke(T1 t1, T2 t2)
- {
- if (Counter++ < Count)
- {
- Action.Invoke(t1, t2);
- }
- }
- public void Bind(ref Action<T1, T2> parent)
- {
- parent += Invoke;
- }
- }
- public class SFSManager : Regist
- {
- #region Config
- public static PlazaRoomEvent PlazaRoomEvent
- {
- get { return GardenSmartFox.EventManager.PlazaRoomEvent; }
- }
- public static PlazaRoomController PlazaRoomController
- {
- get { return GardenSmartFox.PlazaRoomController; }
- }
- public static GardenSmartFox GardenSmartFox;
- #endregion
- public override bool InitAtOnce()
- {
- enabled = true;
- return base.InitAtOnce();
- }
- public void Start()
- {
- GardenSmartFox = new GardenSmartFox();
- }
- public void OnDisable()
- {
- if (GardenSmartFox != null)
- GardenSmartFox.Connector.Disconnect();
- }
- public void OnApplicationQuit()
- {
- if (GardenSmartFox != null)
- {
- GardenSmartFox.Connector.Disconnect();
- }
- //RobotManager.DeactivateAllRobots(false);
- }
- public void Update()
- {
- GardenSmartFox.SmartFox.ProcessEvents();
- GardenSmartFox.PlazaRoomController.Update();
-
- GardenSmartFox.ProcessRequest();
- }
- }
|