public void setItemInfo(int nItemID, int nItemType, int nItemCount, Vector3 startpos,bool bAuto = false) { ItemBaseConfigItem itembasedata = ConfigDataMgr.getInstance().ItemBaseConfig.GetDataByKey(nItemType); UtilTools.SetIcon(_ItemIcon, itembasedata.icon); _bAuto = bAuto; _nItemID = nItemID; transform.position = new Vector3(startpos.x,startpos.y,transform.position.z); _startPos = transform.position; TweenScale scaleAction = _ItemIcon.gameObject.AddComponent<TweenScale>(); scaleAction.from = new Vector3(0, 0, 0); /*if (!NewbieGuideManager.getInstance().isNewbieGuide()) { scaleAction.to = new Vector3(1.5f, 1.5f, 1.5f); TweenPosition posAction = transform.gameObject.AddComponent<TweenPosition>(); posAction.from = transform.localPosition; posAction.to = new Vector3(transform.localPosition.x, transform.localPosition.y + 40f, transform.localPosition.z); posAction.duration = 1.5f; posAction.style = UITweener.Style.PingPong; } else { scaleAction.to = new Vector3(1f, 1f, 1f); }*/ scaleAction.duration = 0.5f; EventDelegate.Add(scaleAction.onFinished, ScaleBahaviorShowFinish, true); UIEventListener.Get(gameObject).onClick = catchItemBehavior; }
public DownloadServiceMgr() { fConfigDataMgr = ConfigDataMgr.Initialize(); fUserDataMgr = UserDataMgr.Initialize(fConfigDataMgr.GetConfig() .General.LoopIntervalSecs.Value); Logger.Initialize(fUserDataMgr.EnableLog.Value); }
// Update 每帧调用一次 override public void Update() { if (!_bStartUp) { return; } base.Update(); int ok_step = _applicationMgr.InitOkStep; if (ApplicationMgr._bInitOK || ok_step == -1)//未开始初始化,或已完成 { UtilTools.SetServerListTip(""); } else { if (ok_step == 1) { float process = ConfigDataMgr.getInstance().GetConfigLoadProcess(); string tips = GameText.Format("initingLoadXml", Mathf.FloorToInt(process * 100).ToString()); UtilTools.SetServerListTip(tips, true, process); } else if (ok_step == 4) { //UtilTools.SetServerListTip(GameText.GetStr("loadingServerList")); } else if (ok_step == 5) { UtilTools.SetServerListTip(GameText.GetStr("loadingNotice"), false, 1f); } } if (ApplicationMgr._bInitOK) { if (_startUpStep == 1) { StartUp_step2(); } else if (_startUpStep == 2 && AssetManager.IsPreLoadComplete()) { StartUp_step3(); } else if (_startUpStep == 3 && GameDataMgr.LOGIN_DATA.IsConnectGamerServer) { /*MainCityController cont = UIManager.GetControler<MainCityController>(); * if (cont.IsActive) * { * StartUp_step4(); * }*/ StartUp_step4(); } else if (_startUpStep == 4 && GameDataMgr.LOGIN_DATA.IsLoginGameServer) { StartUp_step5(); } } }
private void CreateDataFiles() { try { ConfigDataMgr.CreateNew(); UserDataMgr.CreateNew(); } catch (Exception e) { String msg = String.Format("A failure occurred while creating the Storm data files, Message: {0}.", e.Message); MessageBox.Show(msg); } }
// Update 每帧调用一次 override public void Update() { if (!_bStartUp) { return; } if (_startUpStep == 1 && AssetManager.getInstance().IsInitComplete()) { ConfigDataMgr.getInstance().initialize(); _startUpStep = 2; } else if (_startUpStep == 2) { ConfigDataMgr.getInstance().initialize(); _startUpStep = 3; } else if (_startUpStep == 3 && ConfigDataMgr.getInstance().IsAllConfigLoaded()) { if (mono != null) { modelId = mono.modelId; } _3DModelCreating = PlayerManager.getInstance().createModel(modelId, OnCreateModelCB, Vector3.zero); _startUpStep = 4; } else if ((_startUpStep == 4 && mono != null && (pathid != mono.selectPath || modelId != mono.modelId))) { FishPathDataMgr.getInstance().initialize(); //path.fishPathID = mono.selectPath; pathid = mono.selectPath; modelId = mono.modelId; _3DModelCreating.destroy(); _3DModelCreating = PlayerManager.getInstance().createModel(modelId, OnCreateModelCB, Vector3.zero); mono.isChangeModel = false; } else if (mono.isChangeModel && _startUpStep == 4) { FishPathDataMgr.getInstance().initialize(); //path.fishPathID = mono.selectPath; pathid = mono.selectPath; modelId = mono.modelId; _3DModelCreating.destroy(); _3DModelCreating = PlayerManager.getInstance().createModel(modelId, OnCreateModelCB, Vector3.zero); mono.isChangeModel = false; } base.Update(); }
void Update() { if (_initOKStep == 0) { //step1:先加载依赖关系 if (AssetManager.getInstance().IsInitComplete()) { Utils.LogSys.Log("ApplicationMgr DataInit Step1 OK----->" + (Time.realtimeSinceStartup - _lastLogTime).ToString()); _lastLogTime = Time.realtimeSinceStartup; _initOKStep = 1; InitData_Step2(); } } else if (_initOKStep == 1) { //step2:加载配置文件 if (ConfigDataMgr.getInstance().IsAllConfigLoaded()) { Utils.LogSys.Log("ApplicationMgr DataInit Step2 OK----->" + (Time.realtimeSinceStartup - _lastLogTime).ToString()); _lastLogTime = Time.realtimeSinceStartup; _initOKStep = 2; task.TaskManager.MAX_CONCURRENCY_TASK = temp_task_count; InitData_Step3(); SDKManager.getInstance().sendNewbieguideDeviceUniqueIdentifier("3"); } } else if (_initOKStep == 5) { if (luaSvrManager.getInstance().IsLoaded == true) { InitData_Complete(); _initOKStep = 6; } } else if (_initOKStep > 5) { if (Application.platform == RuntimePlatform.Android && (Input.GetKeyDown(KeyCode.Escape))) { SDKManager.getInstance().CommonSDKInterface.exit(); } } }
public void LoadFromConfig() { /************************************************************************/ ConfigDataMgr configDataMgr = ConfigDataMgr.Initialize(); Config config = configDataMgr.GetConfig(); fNetworkURL = config.General.ServiceURL; fPlayer = config.Player; DataRequestor.Initialize(fNetworkURL); /************************************************************************/ /************************************************************************/ UserDataMgr userDataMgr = UserDataMgr.Initialize(config.General.LoopIntervalSecs.Value); fUserID = userDataMgr.UserLogonID; fUserPassword = userDataMgr.UserPIN; /************************************************************************/ Logger.Initialize(userDataMgr.EnableLog.Value); }
/// <summary> /// 显示提示窗口 /// </summary> /// <param name="text">提示内容</param> /// <param name="icon">游戏币图标名称</param> /// <param name="iconNum">游戏币数量</param> /// <param name="alignment">"Left" "Center"</param> /// <param name="okCallbackFunc"></param> /// <param name="cancelCallbackFunc"></param> public void ShowMessageDialog(string text, MoneyType _type, string iconNum, string alignment, DelegateType.MessageDialogUseMoneyCallBack okCallbackFunc, DelegateType.MessageDialogUseMoneyCallBack cancelCallbackFunc, UseType useType) { EventMultiArgs args = new EventMultiArgs(); useflag = useType; args.AddArg("text", text); args.AddArg("iconNum", iconNum); args.AddArg("alignment", alignment); string icon = "C100"; switch (_type) { case MoneyType.GLOD: icon = "C102"; moneyKey = 102; if (GameDataMgr.PLAYER_DATA.Gold >= ulong.Parse(iconNum)) { isEnough = true; } else { isEnough = false; } break; case MoneyType.DIAMOND: icon = "C104"; moneyKey = 104; if (GameDataMgr.PLAYER_DATA.Diamond >= int.Parse(iconNum)) { isEnough = true; } else { isEnough = false; } break; case MoneyType.SILVER: icon = "C101"; moneyKey = 101; if (GameDataMgr.PLAYER_DATA.Gold >= ulong.Parse(iconNum)) { isEnough = true; } else { isEnough = false; } break; } if (!isEnough) { ItemBaseConfigItem item = ConfigDataMgr.getInstance().ItemBaseConfig.GetDataByKey(moneyKey); if (item != null) { UtilTools.MessageDialog(GameText.Format("message_desc4", item.name)); } return; } okCallback = okCallbackFunc; cancelCallback = cancelCallbackFunc; if (useType != UseType.DefaultType) { string flag = PlayerPrefs.GetString("CheckIsShow" + (int)useType); if (!string.IsNullOrEmpty(flag)) { if (flag == "1") { OnClickOK(); return; } } } UIManager.CreateWinByAction(UIName.MESSAGE_DIALOG_USE_MONEY); args.AddArg("icon", icon); //int callbackCount = 0; //if (okCallback != null) // callbackCount += 1; //if (cancelCallback != null) // callbackCount += 1; //args.AddArg("callbackCount", callbackCount); CallUIEvent(UIEventID.MESSAGE_DIALOG_SET_TEXT, args); }
public static IEnumerator LoadPic(string path, string key) { if (path.Length <= 3) { yield break; } WWW www = new WWW(path); yield return(www); if (www != null && string.IsNullOrEmpty(www.error)) { if (savePic.ContainsKey(key)) { savePic[key] = www.texture; } else { savePic.Add(key, www.texture); } SavePicToLocal(key, path); Texture2D newTex = www.texture; SharePictureConfigItem picData = ConfigDataMgr.getInstance().SharePictureConfig.GetDataByKey(key); if (picData == null) { yield break; } Testencoded = new Texture2D(picData.qrisize, picData.qrisize); int pos_x = picData.pos_x - picData.qrisize / 2; int pos_y = picData.pos_y - picData.qrisize / 2; EncodeNew(Testencoded, BarcodeCam.getInstance().Lastresult, Testencoded.width, Testencoded.height, 0); newTex.SetPixels32(pos_x, pos_y, Testencoded.width, Testencoded.height, Testencoded.GetPixels32()); newTex.Apply(); // if (sdk.SDKManager.isAppStoreVersion()) // { // float targetWidth_f = (float)newTex.width * 0.6f; // float targetHight_f = (float)newTex.height * 0.6f; // int targetWidth_d = (int)targetWidth_f; // int targetHight_d = (int)targetHight_f; // Texture2D smallTex = new Texture2D(targetWidth_d, targetHight_d, newTex.format, false); // targetWidth_d = smallTex.width; // targetHight_d = smallTex.height; // targetWidth_f = (float)targetWidth_d; // targetHight_f = (float)targetHight_d; // for (int i = 0; i < targetHight_d; i++) // { // for (int j = 0; j < targetWidth_d; j++) // { // Color newColor = newTex.GetPixelBilinear((float)j / targetWidth_f, (float)i / targetHight_f); // smallTex.SetPixel(j,i,newColor); // } // } // smallTex.Apply(); // newTex = smallTex; // } string newKey = key + "_qri"; if (savePic.ContainsKey(newKey)) { savePic[newKey] = newTex; } else { savePic.Add(newKey, newTex); } SavePicToLocal(newKey, path); string sPath = Application.persistentDataPath; string filePath = string.Format("{0}/ShareIcon/{1}/{2}.png", sPath, userId, newKey); SharePicList.Add(filePath); } }
private void UpdateUIByState(VersionData.VersionType eType) { switch (eType) { case VersionData.VersionType.Checking: //正在检测 tfBoxChecking.gameObject.SetActive(true); tfBoxLoading.gameObject.SetActive(false); break; case VersionData.VersionType.None: //无版本要更新,或已更新完成 tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(false); if (_eLastType == VersionData.VersionType.Inner) //更新完成 { tfBoxLoading.gameObject.SetActive(true); loadingTip.text = "资源更新完成";//GameText.GetStr("updateFinish"); sliderProgress.value = 1f; if (ClientNetwork._bLoginOut) { //UIManager.DestroyWin(UIName.MAIN_CITY_WIN); //UIManager.DestroyWin(UIName.MAIN_CITY_CENTER_WIN); ApplicationMgr.KillSelf(); //销毁,让它重新加载配置文件 AssetManager.getInstance().ClearAll(); ConfigDataMgr.getInstance().ClearAll(); GameDataMgr.ClearAll(); MsgCallManager.RemoveAllCallback(); MsgCallManager.Dispose(); EventSystem.Dispose(); } Invoke("OnUpdateVersionComplete", 0.5f); } else { //tfJuHuaLoading.gameObject.SetActive(true); //if (ClientNetwork._bLoginOut)//如果是註銷出來的 //{ // UIManager.CreateWin(UIName.LOGIN_WIN); // Invoke("DelayToHideVersionUpdate", 0.5f); //} //else//如果第一次登錄進來 //{ // GameObject sceneObj = GameObject.Find("Scene"); // if (sceneObj) // { // StartUpScene startUpMono = sceneObj.GetComponent<StartUpScene>(); // if (startUpMono) // startUpMono.StartUp(); // } //} sliderProgress.value = 0f; GameObject sceneObj = GameObject.Find("Scene"); if (sceneObj) { StartUpScene startUpMono = sceneObj.GetComponent <StartUpScene>(); if (startUpMono) { startUpMono.StartUp(); } } } break; case VersionData.VersionType.Inner: //内更资源 //tfJuHuaLoading.gameObject.SetActive(false); tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); if (_isDownloading == false) //提示框 { if (UtilTools.GetCurrentNetworkType() == 1) //wifi { tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OnClickOKButton(null); } else { tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); loadingTip.text = string.Format("当前非WIFI网络环境,是否继续下载更新包({0})?", GetVersionDataSize()); //"有新版本发布,快去下载吧";//GameText.GetStr("checkTip"); tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OKButtonText.text = "确定"; } } else //刷进度 { loadingTip.text = string.Format("下载资源包(编号{0}): {1}/{2}", GetDownloadingVersion(), GetLoadedSize(), GetVersionDataSize()); sliderProgress.value = _versionData.GetUpdatePercent(); tfOKButton.gameObject.SetActive(false); tfSlider.gameObject.SetActive(true); } OKButtonText.text = "更新"; //GameText.GetStr("update"); break; case VersionData.VersionType.Program: //更新程序版本 //tfJuHuaLoading.gameObject.SetActive(false); if (_isDownloading == false) //提示框 { if (!string.IsNullOrEmpty(SDKManager.PackageDownloadWeb)) //跳网页 { tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); loadingTip.text = "有新版本发布,快去下载吧"; tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OKButtonText.text = "更新"; } else if (!string.IsNullOrEmpty(SDKManager.PackageDownloadUrl)) //内部下载 { if (UtilTools.GetCurrentNetworkType() == 1) { tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OnClickOKButton(null); } else { tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); loadingTip.text = string.Format("当前非WIFI网络环境,是否继续下载版本包({0}M)?", VersionData._strPackageSize); //"有新版本发布,快去下载吧";//GameText.GetStr("checkTip"); tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OKButtonText.text = "确定"; } } else //如果没指定更新地址, 就不强制更新. { VersionData.ShowTipWhenInToGame = true; UpdateUIByState(VersionData.VersionType.None); //直接跳过, 在点"进入游戏"时,提示有新版本,请前往更新. return; } } else //刷内部下载进度 { if (_bLoadPackageFailed) { _isDownloading = false; tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); loadingTip.text = string.Format("{0}(错误码:{1})", _strbLoadPackageFailed_msg, _strLoadPackageFailed_code); tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OKButtonText.text = "重新下载"; return; } else if (_bLoadPackageComplete) { loadingTip.text = string.Format("下载版本包完成,正在安装..."); } else { loadingTip.text = string.Format("下载版本包({0}): {1:F}M / {2:F}M", VersionData._toLoadProgramVersion, loadedPackageSize, totalPackageSize); } sliderProgress.value = loadedPackageSize / totalPackageSize; tfOKButton.gameObject.SetActive(false); tfSlider.gameObject.SetActive(true); } break; case VersionData.VersionType.Error: //更新出错 VersionData.ErrorCode errorCode = _versionData.ErrorCodeData; tfBoxChecking.gameObject.SetActive(false); tfBoxLoading.gameObject.SetActive(true); loadingTip.text = string.Format("检测版本中断,请检查网络后重试。(错误码:{0})", errorCode); tfOKButton.gameObject.SetActive(true); tfSlider.gameObject.SetActive(false); OKButtonText.text = "确定"; break; default: break; } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// 加载 /// </summary> public void load() { if (_strModelID.Length == 0) { return; } _pObjModelData = PlayerManager.ModelData.getGameModelData(_strModelID); if (_pObjModelData == null) { //Utils.LogSys.LogWarning("Model config data is missed. " + _strModelID); return; } //获取数据 _listBindPoints = _pObjModelData._listModelBps; _listAnimEvent = _pObjModelData._listAnimEvents; _listAnimations = _pObjModelData._listAnimations; //获取模型部件列表 //模型 = 部件加载 + 部件组装 + 材质 ElementConfig cfg = (ElementConfig)ConfigDataMgr.getInstance().GetData(ConfigDataType.ModelElementConfig); ElementConfigItem modelData = cfg.GetDataByKey(_strModelID); if (modelData == null) { Utils.LogSys.LogWarning(" ElementConfigItem is null " + _strModelID); } string strLev = levToWeaponAndMaterialIdx(); List <string> listTemp = new List <string>(); for (int i = 0; i < modelData.getKeys().Count; i++) { var strKey = modelData.getKeys()[i]; if (strKey == "key") { continue; } if (!(bool)modelData[strKey]) { continue; } var strComponent = strKey.ToLower().Contains("weapon") && strLev != "" ? strKey + "_" + strLev : strKey; //忽略部件不创建 if (!_listIgnoreComponents.Contains(strComponent)) { _listUncomplete.Add(strComponent); listTemp.Add(strComponent); } } for (int i = 0; i < listTemp.Count; i++) { string strKey = listTemp[i]; _listElement.Add(new ModelElement(strKey, strKey, _strModelID, this)); } loadBaseElement(); }
public static ConfigDataMgr getInstance() { return(ConfigDataMgr.getInstance()); }
private void initUI() { _bg = transform.Find("Container"); GameObject backGo = transform.Find("Container/closeBtn").gameObject; UIEventListener.Get(backGo).onClick = _ctrl.GoBack; GameObject weixinBtn = transform.Find("Container/bg/Sprite/WeiXin").gameObject; UIEventListener.Get(weixinBtn).onClick = buyItem; GameObject zhifubaoBtn = transform.Find("Container/bg/Sprite/ZhiFuBao").gameObject; UIEventListener.Get(zhifubaoBtn).onClick = buyItem; _nameLb = transform.Find <UILabel>("Container/bg/name"); _iconSpr = transform.Find <UISprite>("Container/bg/icon"); _priceLb = transform.Find <UILabel>("Container/bg/price"); if (_ctrl._shopData != null && _ctrl._shopData.cost_list.Count > 0 && _ctrl._shopData.cost_list[0].cost_type != 999) { pb_shop_item shopitem = _ctrl._shopData; SetShow(shopitem); _sCurName = TextUtils.GetString(shopitem.name); _nType = 0; _nCost = (int)shopitem.cost_list[0].cost_num; _nCurKey = (int)shopitem.id; _sCurDes = TextUtils.GetString(shopitem.name); } else if (_ctrl._shopData != null && _ctrl._shopData.cost_list.Count > 0 && _ctrl._shopData.cost_list[0].cost_type == 999) { pb_shop_item shopitem = _ctrl._shopData; SetShow(shopitem); ItemBaseConfigItem itembasedata = ConfigDataMgr.getInstance().ItemBaseConfig.GetDataByKey(shopitem.item_id); string sItemCount = ""; if (shopitem.item_num > 0) { if (shopitem.item_id != 101) { sItemCount = string.Format(GameText.GetStr("shop_count"), shopitem.item_num); } else { sItemCount = shopitem.item_num.ToString(); } } _sCurName = string.Format("{0}{1}", sItemCount, itembasedata.name); _nCost = (int)shopitem.cost_list[0].cost_num; string sPrice = ""; if (shopitem.cost_list[0].cost_type == 999) { sPrice = string.Format(GameText.GetStr("shop_rmb"), shopitem.cost_list[0].cost_num); _nType = 0; } else if (shopitem.cost_list[0].cost_type == 102) { sPrice = string.Format(GameText.GetStr("shop_yuanbao"), shopitem.cost_list[0].cost_num); _nType = 1; } else if (shopitem.cost_list[0].cost_type == 101) { sPrice = string.Format(GameText.GetStr("shop_jinbi"), shopitem.cost_list[0].cost_num); _nType = 2; } else if (shopitem.cost_list[0].cost_type == 103) { sPrice = string.Format(GameText.GetStr("shop_zuanshi"), shopitem.cost_list[0].cost_num); _nType = 3; } _nCurKey = (int)shopitem.id; _sCurDes = TextUtils.GetString(shopitem.name); } }
//初始化第2步 void InitData_Step2() { task.TaskManager.MAX_CONCURRENCY_TASK = 2; //配置文件管理类初始化 ConfigDataMgr.getInstance().initialize(); }