Пример #1
0
    // ===================================== //
    // protected - Unity API                 //
    // ===================================== //

    protected override void OnAwake()
    {
        base.OnAwake();

        _iLocalDataLoadingCount_Request = 0;
        _iLocalDataLoadingCount_Finish  = 0;

        _pJsonParser_Persistent       = SCManagerParserJson.DoMakeInstance(this, "", EResourcePath.PersistentDataPath);
        _pJsonParser_StreammingAssets = SCManagerParserJson.DoMakeInstance(this, const_strLocalPath_INI, EResourcePath.StreamingAssets);
        _pJsonParser_JsonData         = SCManagerParserJson.DoMakeInstance(this, SCManagerParserJson.const_strFolderName, EResourcePath.Resources);

        _pManagerScene = new SCSceneLoader <ENUM_Scene_Name>();
        _pManagerScene.p_EVENT_OnSceneLoaded += ProcOnSceneLoaded;

        ProcParse_UserSetting();

        _iLocalDataLoadingCount_Request++;
        _iLocalDataLoadingCount_Request++;
        _iLocalDataLoadingCount_Request++;
        _pJsonParser_StreammingAssets.DoStartCo_GetStreammingAssetResource_Array <SINI_Sound>(EINI_JSON_FileName.Sound.ToString(), OnParseComplete_SoundSetting);
        _pJsonParser_StreammingAssets.DoStartCo_GetStreammingAssetResource <SINI_ApplicationSetting>(EINI_JSON_FileName.ApplicationSetting.ToString(), OnFinishParse_AppSetting);

        if (CManagerUILocalize.instance == null)
        {
            CManagerUILocalize.EventMakeSingleton();
        }

        CManagerUILocalize.instance.DoStartParse_Locale(CUIManagerLocalize_p_EVENT_OnChangeLocalize);
    }
Пример #2
0
    /* protected - Override & Unity API         */

    protected override void OnMakeSingleton()
    {
        base.OnMakeSingleton();

        SCManagerParserJson pManagerParser = SCManagerParserJson.DoMakeInstance(null, const_strResourcesJsonDataPath, EResourcePath.Resources);

        pManagerParser.DoReadJson_And_InitEnumerator(const_strResourcesFileName, ref _mapDataTable_Dialogue);
    }
Пример #3
0
    protected override void OnAwake()
    {
        base.OnAwake();

        Dictionary <EPropTest, SDataProp> _mapData_Prop = new Dictionary <EPropTest, SDataProp>();
        SCManagerParserJson pParser = SCManagerParserJson.DoMakeInstance(this, SCManagerParserJson.const_strFolderName, EResourcePath.Resources);

        pParser.DoReadJson_And_InitEnumerator("인게임오브젝트_테스트", ref _mapData_Prop);

        var listTest = _mapData_Prop.ToList();

        for (int i = 0; i < listTest.Count; i++)
        {
            Debug.Log(string.Format("Key : {0} Value ( i등장확률 : {1} i최대드랍골드 : {2} )", listTest[i].Key, listTest[i].Value.i등장확률, listTest[i].Value.i최대드랍골드));
        }
    }
Пример #4
0
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/

    public void DoInit(MonoBehaviour pBaseClass, string strFolderPath)
    {
        _mapPreParsingObject.Clear();
        if (_pManagerParserJson == null)
        {
            _pManagerParserJson = SCManagerParserJson.DoMakeInstance(pBaseClass, strFolderPath, EResourcePath.Resources);
        }

        List <KeyValuePair <string, TextAsset> > listResource = _pManagerParserJson.p_mapResourceOrigin.ToList();

        System.Type pType = typeof(T_Key);
        if (pType.IsEnum)
        {
            for (int i = 0; i < listResource.Count; i++)
            {
                KeyValuePair <string, TextAsset> pKey = listResource[i];
                T_Key tKey = pKey.Key.ConvertEnum <T_Key>();
                Class_PreParsingType pData;
                if (_pManagerParserJson.DoReadJson_FromResource(tKey, out pData))
                {
                    _mapPreParsingObject.Add(tKey, pData);
                }
                else
                {
                    System.Type pTypeClass = typeof(Class_PreParsingType);
                    Debug.LogWarningFormat("[Error] SCManagerPreParserJson<{0}, {1}>.Parsing Fail Key : {2}", pType.Name, pTypeClass, tKey);
                }
            }
        }
        else
        {
            for (int i = 0; i < listResource.Count; i++)
            {
                KeyValuePair <string, TextAsset> pKey = listResource[i];
                T_Key tKey = (T_Key)(object)pKey.Key;
                Class_PreParsingType pData;
                if (_pManagerParserJson.DoReadJson_FromResource(tKey, out pData))
                {
                    _mapPreParsingObject.Add(tKey, pData);
                }
            }
        }
    }
Пример #5
0
    protected IEnumerator CoLoadDataFromServer <T>(string hID, string strPHPName, System.Action <bool, T> OnFinishLoad, params StringPair[] arrParameter)
    {
        bool   bSuccess    = true;
        T      pData       = default(T);
        string strTypeName = typeof(T).ToString();
        WWW    www         = GetWWW(hID, strPHPName, strTypeName, arrParameter);

        yield return(www);

        //Debug.Log(strPHPName + " result : " + www.text);

        List <T> listOutData = new List <T>();

        bSuccess = www.error == null;
        try
        {
            bSuccess = SCManagerParserJson.DoReadJsonArray <T>(www, ref listOutData);
            if (listOutData.Count > 0)
            {
                pData = listOutData[0];
            }
        }
        catch
        {
            bSuccess = false;
        }

        if (bSuccess == false)
        {
            Debug.Log("DBParser Error " + www.text + " php : " + strPHPName + " TableName : " + strTypeName);
        }

        if (OnFinishLoad != null)
        {
            OnFinishLoad(bSuccess, pData);
        }

        yield break;
    }
Пример #6
0
    /* public - [Event] Function
     * 프랜드 객체가 호출                       */

    // ========================================================================== //

    /* private - [Proc] Function
     * 중요 로직을 처리                         */

    static private void Check_And_InitManagerLogin()
    {
        if (_pObjectDummy_ForCoroutine != null)
        {
            return;
        }

        GameObject pObjectDummy = new GameObject("ManagerLogInDummy_ForCoroutine");

        _pObjectDummy_ForCoroutine = pObjectDummy.AddComponent <CCompoTemp>();

        _pManagerJson = SCManagerParserJson.DoMakeInstance(_pObjectDummy_ForCoroutine, const_strLocalPath_INI, EResourcePath.PersistentDataPath);
        if (_pManagerJson.DoReadJson_FromResource <string, SINI_Account>(const_strLogInFileName, out _pLoginInfo) == false)
        {
            _pLoginInfo = new SINI_Account();
            _pManagerJson.DoWriteJson <string>(const_strLogInFileName, _pLoginInfo);
        }
        else
        {
            _strEmailAddress = _pLoginInfo.strEmailAddress;
            _strPassword     = _pLoginInfo.strPassword;
        }
    }
Пример #7
0
    public IEnumerator CoLoadDataListFrom_Array <T>(string hID, string strPHPName, System.Action <bool, T[]> OnFinishLoad, params StringPair[] arrParameter)
    {
        bool   bSuccess    = true;
        string strTypeName = typeof(T).ToString();
        WWW    www         = GetWWW(hID, strPHPName, strTypeName, arrParameter);

        yield return(www);

        T[] arrOutData = null;
        bSuccess = www.error == null;
        try
        {
            bSuccess = SCManagerParserJson.DoReadJsonArray <T>(www, out arrOutData);
        }
        catch
        {
            bSuccess = false;
        }

        if (bSuccess == false)
        {
            Debug.Log("DBParser Warning " + www.text + " php : " + strPHPName + " TableName : " + strTypeName, null);
        }

        if (arrOutData == null)
        {
            arrOutData = new T[0];
        }

        if (OnFinishLoad != null)
        {
            OnFinishLoad(bSuccess, arrOutData);
        }

        yield break;
    }
Пример #8
0
    public IEnumerator CoLoadDataListFrom_Array <T>(string hID, string strPHPName, delDBRequest_GenericArray <T> OnFinishLoad, params StringPair[] arrParameter)
    {
        string strTableName = typeof(T).Name;

        if (p_Event_DB_OnRequest_Start != null)
        {
            p_Event_DB_OnRequest_Start(strTableName, arrParameter);
        }

        //UnityEngine.Networking.UnityWebRequest www;
        WWW  www;
        int  iRequestCount = 0;
        bool bSuccess;

        while (true)
        {
            bSuccess = true;
            www      = GetWWW(hID, strPHPName, strTableName, arrParameter);
            yield return(www);

            //www = GetWWWNew( hID, strPHPName, strTableName, arrParameter );
            //yield return www.SendWebRequest();

            T[] arrOutData = null;
            bSuccess = www.error == null;
            try
            {
                bSuccess = SCManagerParserJson.DoReadJsonArray <T>(www, out arrOutData);
            }
            catch
            {
                bSuccess = false;
            }

            if (OnFinishLoad == null)
            {
                break;
            }
            else if (OnFinishLoad(bSuccess, ++iRequestCount, arrOutData))
            {
                break;
            }
        }

        if (bSuccess == false)
        {
            Debug.Log("DBParser Warning " + www.text + " php : " + strPHPName + " TableName : " + strTableName + " iRequestCount : " + iRequestCount, null);
            //Debug.Log( "DBParser Warning " + www.downloadHandler.text + " php : " + strPHPName + " TableName : " + strTableName + " iRequestCount : " + iRequestCount, null );
            for (int i = 0; i < arrParameter.Length; i++)
            {
                Debug.LogWarning(string.Format("Key{0} : {1}, Value{2} : {3} ", i, arrParameter[i].strKey, i, arrParameter[i].strValue));
            }
        }

        if (p_Event_DB_OnRequest_Finish != null)
        {
            p_Event_DB_OnRequest_Finish(strTableName, arrParameter);
        }

        yield break;
    }
Пример #9
0
    protected IEnumerator CoLoadDataFromServer <T>(string hID, string strPHPName, delDBRequest_Generic <T> OnFinishLoad, params StringPair[] arrParameter)
    {
        T      pData        = default(T);
        string strTableName = typeof(T).ToString();

        if (p_Event_DB_OnRequest_Start != null)
        {
            p_Event_DB_OnRequest_Start(strTableName, arrParameter);
        }

        int  iRequestCount = 0;
        WWW  www;
        bool bSuccess = true;

        while (true)
        {
            bSuccess = true;
            www      = GetWWW(hID, strPHPName, strTableName, arrParameter);
            yield return(www);

            //Debug.Log(strPHPName + " result : " + www.text);

            List <T> listOutData = new List <T>();
            bSuccess = www.error == null;
            try
            {
                bSuccess = SCManagerParserJson.DoReadJsonArray <T>(www, ref listOutData);
                pData    = listOutData[0];
            }
            catch
            {
                bSuccess = false;
            }


            if (OnFinishLoad == null)
            {
                break;
            }
            else if (OnFinishLoad(bSuccess, ++iRequestCount, pData))
            {
                break;
            }
        }

        if (bSuccess == false)
        {
            Debug.LogWarning("[DBParser Error] RequestCount : " + iRequestCount + " php : " + strPHPName + " TableName : " + strTableName + " Error : " + www.text);
            for (int i = 0; i < arrParameter.Length; i++)
            {
                Debug.LogWarning(string.Format("Key{0} : {1}, Value{2} : {3} ", i, arrParameter[i].strKey, i, arrParameter[i].strValue));
            }
        }

        if (p_Event_DB_OnRequest_Finish != null)
        {
            p_Event_DB_OnRequest_Finish(strTableName, arrParameter);
        }

        yield break;
    }