Esempio n. 1
0
        private void Awake()
        {
            if (m_instance != null && m_instance != this)
            {
                throw new InvalidOperationException();
            }

            m_instance = this;

            m_serializer = new ProtobufSerializer();

            m_persistentDataPath = Application.streamingAssetsPath;
            Debug.Log(m_persistentDataPath);

            m_stats = GState.GetValue <ServerStats>("LocalGameServer.m_stats");
            if (m_stats == null)
            {
                m_stats = new ServerStats();
                GState.SetValue("LocalGameServer.m_stats", m_stats);
            }


            m_loggedInPlayers = GState.GetValue <HashSet <Guid> >("LocalGameServer.m_loggedInPlayers");
            if (m_loggedInPlayers == null)
            {
                m_loggedInPlayers = new HashSet <Guid>();
                GState.SetValue("LocalGameServer.m_loggedInPlayers", m_loggedInPlayers);
            }

            LoadPlayers();
            GState.SetValue("LocalGameServer.m_players", m_players);
        }
Esempio n. 2
0
        private void OnDestroy()
        {
            if (m_instance == this)
            {
                m_instance = null;
            }

            m_serializer = null;
        }