12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using UnityEngine;
- using UnityEngine.Events;
- using System.Collections;
- public class InviteData
- {
- public enum State
- {
- Online = 0,
- Battle = 1,
- Offline = 2,
- }
- private static System.Array stateArr = System.Enum.GetValues (typeof(State));
- public static State GetStateByCode(int code)
- {
- return (State)stateArr.GetValue (code);
- }
- public enum Action
- {
- Invite = 0,
- Waiting = 1,
- Refuse = 2,
- InTeam = 3,
- }
- private static System.Array actionArr = System.Enum.GetValues (typeof(Action));
- public static Action GetActionByCode(int code)
- {
- return (Action)actionArr.GetValue (code);
- }
- public const float INVITE_HOLD_ON = 30f;
- public const float INVITE_REFUSE_HOLD_ON = 5f;
- public int id;
- public float lastActionTime;
- public UnityEvent StateChanged;
- public UnityEvent ActionChanged;
- public InviteData()
- {
- StateChanged = new UnityEvent ();
- ActionChanged = new UnityEvent ();
- }
- private State m_State;
- public State state
- {
- get{
- return m_State;
- }
- set{
- m_State = value;
- StateChanged.Invoke ();
- }
- }
- private Action m_Action;
- public Action action
- {
- get{
- return m_Action;
- }
- set{
- m_Action = value;
- lastActionTime = GameTime.time;
- ActionChanged.Invoke ();
- }
- }
- }
|