/// <summary> /// 配置数据初始化 /// </summary> public void Init(string vConfigText) { // 总配置转换 TextAsset vConfigAsset = null; if (string.IsNullOrEmpty(vConfigText)) { vConfigAsset = Resources.Load(LocalTextFilePath) as TextAsset; // 从本地取 vConfigText = vConfigAsset.text; } configPackage = JsonUtility.FromJson <GameConfig> (vConfigText); evidenceConfig = new EvidenceConfig(configPackage.value); // 读取tips vConfigAsset = Resources.Load(LocalTipsFilePath) as TextAsset; // 从本地取 vConfigText = vConfigAsset.text; tipsConfig = new TipsConfig(JsonUtility.FromJson <GameTipsConfig> (vConfigText).value); // Read Character Table vConfigAsset = Resources.Load(LocalCharacterFilePath) as TextAsset; characterTable = new CharacterTable(vConfigAsset.text); // 内存释放 if (vConfigAsset != null) { Resources.UnloadAsset(vConfigAsset); } isInitialized = true; }
static public string getTips() { if (TipsConfig.getInstance().getDataList().Count > 0) { int r = Common_Random.getRandom(1, TipsConfig.getInstance().getDataList().Count); return(TipsConfig.getInstance().getDataList()[r - 1]); } return(""); }
public TipsCompontent GetTips(TipsConfig tipsConfig = null) { if (tipsConfig == null) { tipsConfig = new TipsConfig(); } string path = "Common/TipsCompontent/Tips_" + tipsConfig.TipsSize + "_" + tipsConfig.TipsDirection; TipsCompontent tipsCompontent = UIFactory.Instance.GetUI <TipsCompontent>(path); tipsCompontent.SetStyle(tipsConfig); return(tipsCompontent); }
/// <summary> /// 设置tips的样式 /// </summary> /// <param name="localScale"></param> /// <param name="fontSize"></param> public void SetStyle(TipsConfig tipsConfig) { _tipsConfig = tipsConfig; _text.fontSize = _tipsConfig.FontSize; _buttonClose.gameObject.SetActive(_tipsConfig.IsCloseAnyKey); if (_tipsConfig.Parent != null) { SetParent(_tipsConfig.Parent); } else { transform.localScale = Vector3.one * _tipsConfig.LocalScale; transform.localPosition = _tipsConfig.Offset; } if (!string.IsNullOrEmpty(_tipsConfig.Content)) { SetContent(_tipsConfig.Content); } }
public async Task getAllData() { UINetLoadingComponent.showNetLoading(); try { await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/tips.json", TipsConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/prop.json", PropConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/zhuanpan.json", ZhuanPanConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/notice.json", NoticeConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/friendRoomConfig.json", FriendRoomConfig.getInstance().init); //await SensitiveWordUtil.Req("http://fwdown.hy51v.com/online/file/stopwords.txt"); string data = CommonUtil.getTextFileByBundle("config", "stopwords"); SensitiveWordUtil.WordsDatas = data.Split(','); } catch (Exception ex) { Log.Error(ex); } UINetLoadingComponent.closeNetLoading(); }
/// <summary> /// 设置Tips的样式 /// </summary> /// <param name="tipsConfig"></param> private void SetTipsStyle(TipsConfig tipsConfig) { _tipsConfig = tipsConfig; }