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); } }
public void OnInitCameraBloom(Camera cam, Engine.JsonObject bloom) { if (bloom == null) { return; } string strBloomName = bloom["name"]; if (!string.IsNullOrEmpty(strBloomName)) { UnityStandardAssets.ImageEffects.BloomAndFlares bloomEffect = null; if (strBloomName == "BloomAndFlares") { //避免重复添加 bloomEffect = cam.gameObject.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>(); if (bloomEffect == null) { bloomEffect = cam.gameObject.AddComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>(); } if (bloomEffect != null) { bloomEffect.lensFlareShader = Shader.Find("Hidden/LensFlareCreate"); bloomEffect.vignetteShader = Shader.Find("Hidden/Vignetting"); bloomEffect.separableBlurShader = Shader.Find("Hidden/SeparableBlurPlus"); bloomEffect.addBrightStuffOneOneShader = Shader.Find("Hidden/BlendOneOne"); bloomEffect.screenBlendShader = Shader.Find("Hidden/Blend"); bloomEffect.hollywoodFlaresShader = Shader.Find("Hidden/MultipassHollywoodFlares"); bloomEffect.brightPassFilterShader = Shader.Find("Hidden/BrightPassFilterForBloom"); bloomEffect.tweakMode = (UnityStandardAssets.ImageEffects.TweakMode34)((int)bloom["TweakMode"]); bloomEffect.screenBlendMode = (UnityStandardAssets.ImageEffects.BloomScreenBlendMode)((int)bloom["BlendMode"]); bloomEffect.hdr = (UnityStandardAssets.ImageEffects.HDRBloomMode)((int)bloom["HDR"]); bloomEffect.bloomIntensity = bloom["Intensity"]; bloomEffect.bloomThreshold = bloom["Threshold"]; bloomEffect.bloomBlurIterations = bloom["BlurIterations"]; bloomEffect.sepBlurSpread = bloom["BlurSpread"]; bloomEffect.lensflares = false; bloomEffect.useSrcAlphaAsMask = 0f; m_lstEffects.Add(bloomEffect); } } } }
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); }