Beispiel #1
0
    void ParseFromFile()
    {
        m_UIXmlRichText = m_widget_root.GetComponent <UIXmlRichText>();
        UnityEngine.Object prefab = UIManager.GetResGameObj("prefab/grid/richtextlabel.unity3d", "Assets/UI/prefab/Grid/RichTextLabel.prefab");
        m_UIXmlRichText.protoLabel = prefab as GameObject;
        m_UIXmlRichText.fontSize   = 24;
        string strFilePath = "notice.json";

        Engine.JsonNode root = Engine.RareJson.ParseJsonFile(strFilePath);
        if (root == null)
        {
            Engine.Utility.Log.Warning("华夏宝典解析{0}文件失败!", strFilePath);
            return;
        }
        Engine.JsonArray noticeArray = (Engine.JsonArray)root["notice"];
        for (int i = 0, imax = noticeArray.Count; i < imax; i++)
        {
            Engine.JsonObject noticeObj = (Engine.JsonObject)noticeArray[i];
            if (noticeObj == null)
            {
                continue;
            }
            QuestionNotice notice = new QuestionNotice();
            notice.index   = int.Parse(noticeObj["index"]);
            notice.title   = noticeObj["title"];
            notice.content = noticeObj["content"];
            m_lstNotice.Add(notice);
        }
    }
Beispiel #2
0
    //GlobalConst.PackageConfigFile
    public static bool LoadPackageConfigFile(string strConfigFile, ref bool bSmallPackage)
    {
        byte[] configBytes;
        string strIniFile = "";

        if (Application.isEditor)
        {
            strIniFile = Engine.Utility.FileUtils.Instance().FullPathFileName(ref strConfigFile, FileUtils.UnityPathType.UnityPath_CustomPath);
        }
        else
        {
            //该配置不做更新
            strIniFile = Engine.Utility.FileUtils.Instance().FullPathFileName(ref strConfigFile, FileUtils.UnityPathType.UnityPath_StreamAsset);
        }
        if (!FileUtils.Instance().ReadFile(strIniFile, out configBytes))
        {
            return(false);
        }

        byte[] desBytes;
        if (!Engine.Utility.Security.EncryptUtil.Decode(ref configBytes, out desBytes))
        {
            configBytes = null;
            return(false);
        }
        configBytes = null;
        string configJsonStr = System.Text.UTF8Encoding.UTF8.GetString(desBytes);

        desBytes = null;
        Engine.JsonNode jsonRoot = Engine.RareJson.ParseJson(configJsonStr);
        if (jsonRoot == null)
        {
            Engine.Utility.Log.Error("GlobalConfig LoadPackageConfigFile 解析{0}文件失败!", configJsonStr);
            return(false);
        }


        try
        {
            bSmallPackage = ((int)jsonRoot["smallPackage"] == 1) ? true : false;
        }
        catch
        {
            bSmallPackage = false;
        }

        return(true);
    }
Beispiel #3
0
    public void InitGvoice()
    {
        if (Application.platform == RuntimePlatform.OSXEditor)
        {
            //Debug.LogError("OSXEditor 不初始化:");
            return;
        }
        m_voiceengine = GCloudVoice.GetEngine();
        if (!System.IO.Directory.Exists(VoiceDataPath))
        {
            System.IO.Directory.CreateDirectory(VoiceDataPath);
        }

        Engine.JsonNode root = Engine.RareJson.ParseJsonFile(GVOICE_FILE);
        if (root == null)
        {
            Engine.Utility.Log.Error("GVoiceManger 解析{0}文件失败!", GVOICE_FILE);
            return;
        }
        m_strAppId  = root["appid"];
        m_strAppkey = root["appkey"];


        if (Application.platform == RuntimePlatform.Android)
        {
            // Debug.LogError("InitGvoice:");
            AndroidJavaClass jc = new AndroidJavaClass("com.hxll.gvoice.Gvoice");
            if (jc != null)
            {
                initRet = jc.CallStatic <int>("InitGVoiceEngine");
            }
            //Debug.LogError("InitGvoice ret :" + initRet);
        }

        m_voiceengine.OnApplyMessageKeyComplete    += OnApplyMessageKeyCompleteHandler;
        m_voiceengine.OnUploadReccordFileComplete  += OnUploadReccordFileCompleteHandler;
        m_voiceengine.OnDownloadRecordFileComplete += OnDownloadRecordFileCompleteHandler;
        m_voiceengine.OnPlayRecordFilComplete      += OnPlayRecordFilCompletehandler;
        m_voiceengine.OnSpeechToText += OnSpeechToTextHandler;

        m_voiceengine.OnJoinRoomComplete += OnJoinRoomCompleteHandler;
        m_voiceengine.OnQuitRoomComplete += OnQuitRoomComplete;
        m_voiceengine.OnMemberVoice      += OnMemberVoiceHandler;
    }
Beispiel #4
0
    public static bool LoadConfigFile(string strConfigFile, ref string strHttpSmallPackagerRUL)
    {
        byte[] configBytes;
        string strIniFile = Engine.Utility.FileUtils.Instance().FullPathFileName(ref strConfigFile, FileUtils.UnityPathType.UnityPath_CustomPath);

        if (!FileUtils.Instance().ReadFile(strIniFile, out configBytes))
        {
            strIniFile = Engine.Utility.FileUtils.Instance().FullPathFileName(ref strConfigFile, FileUtils.UnityPathType.UnityPath_StreamAsset);
            if (!FileUtils.Instance().ReadFile(strIniFile, out configBytes))
            {
                return(false);
            }
        }
        byte[] desBytes;
        if (!Engine.Utility.Security.EncryptUtil.Decode(ref configBytes, out desBytes))
        {
            configBytes = null;
            return(false);
        }
        configBytes = null;
        string configJsonStr = System.Text.UTF8Encoding.UTF8.GetString(desBytes);

        desBytes = null;
        Engine.JsonNode jsonRoot = Engine.RareJson.ParseJson(configJsonStr);
        if (jsonRoot == null)
        {
            Engine.Utility.Log.Error("GlobalConfig LoadConfigFile 解析{0}文件失败!", configJsonStr);
            return(false);
        }
        Engine.JsonObject jsonObj = null;
        /******************SystemConfig开始*****************/
        jsonObj = (Engine.JsonObject)jsonRoot["SystemConfig"];
        if (null != jsonObj)
        {
            //SDKLogin = ((int)jsonObj["SdkLogin"] == 1) ? true : false;
            ////是否开启版本检测
            //verCheck = ((int)jsonObj["vercheck"] == 1) ? true : false;
            //// 是否测试版本
            //alphaVer = ((int)jsonObj["alphaver"] == 1) ? true : false;
            //// Log等级
            //logLevel = (int)jsonObj["loglevel"];
            //Test = ((int)jsonObj["test"] == 1) ? true : false;
            //TestServerId = (uint)jsonObj["testserverid"];
            //FPS = ((int)jsonObj["fps"] == 1) ? true : false;
            //LogServerLevel = (int)jsonObj["logseverlevel"];
        }

        /******************SdkConfig开始*****************/
        Engine.JsonArray jsonArray = (Engine.JsonArray)jsonRoot["SDKConfig"];
        if (null != jsonArray)
        {
            Engine.JsonObject tempJsonObj = null;
            string            platform    = "";
            bool match = false;
            for (int i = 0, max = jsonArray.Count; i < max; i++)
            {
                tempJsonObj = (Engine.JsonObject)jsonArray[i];
                platform    = tempJsonObj["platform"];
                if (Application.platform == RuntimePlatform.Android)
                {
                    if (platform.Equals("android"))
                    {
                        match = true;
                    }
                }
                else if (Application.platform == RuntimePlatform.IPhonePlayer)
                {
                    if (platform.Equals("ios"))
                    {
                        match = true;
                    }
                }
                else
                {
                    if (platform.Equals("windows"))
                    {
                        match = true;
                    }
                }

                if (match)
                {
                    //loginUrl = tempJsonObj["loginurl"];
                    //GameID = (int)tempJsonObj["gameid"];
                    //QuestionnaireURL = tempJsonObj["questionnaireurl"];
                    //DNS = tempJsonObj["dns"];
                    //strRomotePlatformUpdataUrl = tempJsonObj["fullupdataurl"];

                    try
                    {
                        string httpSmallPackagerul = tempJsonObj["smallpackurl"];
                        strHttpSmallPackagerRUL = httpSmallPackagerul;
                        return(true);
                    }
                    catch (System.Exception ex)
                    {
                        strHttpSmallPackagerRUL = string.Empty;
                    }

                    //正式数据
                    //FormalstrRomoteVersionFileUrl = tempJsonObj["verurl"];
                    //FormalAreaServerUrl = tempJsonObj["AreaServerurl"];
                    //FormalNoticeUrl = tempJsonObj["noticeurl"];

                    ////审核数据
                    //Reviewverurl = tempJsonObj["Reviewverurl"];
                    //ReviewAreaServerurl = tempJsonObj["ReviewAreaServerurl"];
                    //Reviewnoticeurl = tempJsonObj["Reviewnoticeurl"];

                    break;
                }
            }
        }

        strHttpSmallPackagerRUL = string.Empty;
        return(true);
    }