Exemple #1
0
    protected void OnDestroy()
    {
        if (ms_Instance == this)         // avoid multiple snSystem
        {
            m_Config.Destroy();
            m_Config = null;

            m_LogRecord.Destroy();
            m_LogRecord = null;

            m_Input    = null;
            m_SceneFSM = null;

            m_Localization.Destroy();
            m_Localization = null;

            ms_Instance = null;
        }
    }
Exemple #2
0
    private IEnumerator Initialize_Co()
    {
        // initialize log record
        m_LogRecord = new snLogRecord();
#if UNITY_EDITOR
        m_LogRecord.Initialize(byte.MaxValue, true);
#else
        m_LogRecord.Initialize((1 << (byte)LogType.Assert)
                               | (1 << (byte)LogType.Assert)
                               | (1 << (byte)LogType.Exception)
                               | (1 << (byte)LogType.Error)
                               | (1 << (byte)LogType.Warning)
                               | (1 << (byte)LogType.Log)
                               , false);
#endif
        yield return(null);

        // initialize config
        m_Config = new snINIParser();
        m_Config.Initialize(SystemInitializer.Config.text);
        System.Text.StringBuilder configLogString = new System.Text.StringBuilder(512);
        configLogString.AppendLine("Loaded Config");
        foreach (KeyValuePair <string, string> kv in m_Config.GetConfig())
        {
            configLogString.AppendLine(string.Format("{0}={1}", kv.Key, kv.Value));
        }
        Debug.Log(configLogString.ToString());
        yield return(null);

        // initialize input
        m_Input = InstantiatePrefabAndSetParentThisTransform <snInput>(SystemInitializer.InputPrefab);
        yield return(null);

        // initialize scene fsm
        m_SceneFSM = InstantiatePrefabAndSetParentThisTransform <snSceneFSM>(SystemInitializer.SceneFSMPrefab);
        yield return(StartCoroutine(m_SceneFSM.ChangeState_Co(m_SceneFSM.GetLobbyState())));

        yield return(null);

        m_Localization = new snLocalization();
        m_Localization.Initialize(SystemInitializer.Localization);
    }