public void Init(ItemItem itemConfig, int showOrder, WeaponRaiseNode parent) { gameObject.SetActive(true); m_Parent = parent; Item.gameObject.SetActive(true); m_ItemConfig = itemConfig; transform.SetSiblingIndex(1 * (showOrder * 10000 + m_ItemConfig.showorder)); GeneralConfigItem gCfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ASK_WEAPON_OPEN_PASS); if (gCfg != null) { int id = int.Parse(gCfg.contents[0]); int openPass = int.Parse(gCfg.contents[1]); if (m_ItemConfig.id == id && Global.gApp.gSystemMgr.GetPassMgr().GetPassSerial() <= openPass) { Item.gameObject.SetActive(false); return; } } UIFresh(); NewbieGuideButton[] newBieButtons = this.GetComponentsInChildren <NewbieGuideButton>(); foreach (NewbieGuideButton newBieButton in newBieButtons) { newBieButton.Param = m_WeaponName; newBieButton.OnStart(); } }
public AttrDTO() { level = 1; GeneralConfigItem limitConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INITIAL_ENERGY); energy = int.Parse(limitConfig.content); }
private void CompleteOpen() { box_open.gameObject.SetActive(true); box_close.gameObject.SetActive(false); Global.gApp.gMsgDispatcher.Broadcast <int, int, Vector3>(MsgIds.ShowRewardGetEffect, m_ItemDTO.itemId, (int)m_ItemDTO.num * 2, box_open.rectTransform.position + new Vector3(0, 1.6f, 0)); GeneralConfigItem generalConfigItem = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.OPEN_BOX_DELAY_SECOND); int delay = int.Parse(generalConfigItem.content); if (m_ItemDTO.itemId == SpecialItemIdConstVal.GOLD) { Global.gApp.gAudioSource.PlayOneShot("coin_box", true); } else { Global.gApp.gAudioSource.PlayOneShot("box", true); } gameObject.AddComponent <DelayCallBack>().SetAction(() => { Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh); TouchClose(); }, delay, true); }
private static string GenerateClassificationJson(GeneralConfigItem config, string cacheFilename) { var mailsync = new MailSync(config.Host, config.Port, config.Username, config.Password, config.MailBox, config.Assignments.Select(t => t.ConvertBack()).ToList()); ICachePersistence cache = null; if (cacheFilename != null) { cache = new JsonCachePersistence(cacheFilename); mailsync.CacheService.LoadCache(cache); } var assignments = (from ass in mailsync.Assignments select new AssignmentUpdateItemDto() { Name = ass.Name, Items = (from u in mailsync.Classify(ass) select u.SerializeJson()).ToList() }).ToList(); if (cacheFilename != null) { mailsync.CacheService.SaveCache(cache); } return(JsonConvert.SerializeObject(assignments)); }
private void InitNode() { CampShopItem campShopItem = m_ItemUI.GetCampItem(); CloseBtn.button.onClick.AddListener(TouchClose); ItemItem itemItem = Global.gApp.gGameData.ItemData.Get(campShopItem.propId); Debug.Log(itemItem.image_grow); MatIcon.image.sprite = Resources.Load(itemItem.image_grow, typeof(Sprite)) as Sprite; MatName.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(itemItem.sourceLanguage); GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); if (itemItem.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { bgBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, itemItem.qualevel), typeof(Sprite)) as Sprite; MatName.text.color = ColorUtil.GetColor(colorConfig.contents[itemItem.qualevel]); } else { bgBottom.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; MatName.text.color = ColorUtil.GetColor(colorConfig.contents[2]); } EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = itemItem.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? itemItem.qualevel.ToString() : "common"; GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), EffectPos.rectTransform); effect.transform.localPosition = new Vector3(0f, 0f, 0f); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] pss = effect.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in pss) { ps.GetComponent <Renderer>().sortingOrder = 51; } }
//private Map m_Map; public FightScene(PassItem passData) { m_TimerMgr = new TimerMgr(); m_Ended = false; m_PassData = passData; m_SceneType = (SceneType)passData.sceneType; m_InNormalPassType = (m_SceneType == SceneType.NormalScene); GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); int type = passData.id / System.Convert.ToInt32(initPassIdConfig.content); if (type == 1) { if (Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId() != m_PassData.id || Global.gApp.gSystemMgr.GetPassMgr().GetHasPassedMaxPass()) { m_ModeEnum = ModeEnum.RE_NORMAL; } else { m_ModeEnum = ModeEnum.NORMAL; } } else { m_ModeEnum = ModeEnum.SPECIAL; } Global.gApp.gLightCompt.enabled = true; //m_Map = new Map(90, 90, m_MainPlayer); }
public override double GetDefault(float[] condition) { float cur = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId(); GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); return(cur % Convert.ToInt32(initPassIdConfig.content) - 1); }
public override bool FilterQuest(float[] condition, float[] param) { QuestItemDTO questItemDTO = null; if (param.Length >= 1) { questItemDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetQuestItemDTO((int)param[0]); } if (questItemDTO == null) { return(false); } GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); float cur = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId() % Convert.ToInt32(initPassIdConfig.content) - 1; bool isUpdate = false; if (condition.Length > 1) { if (questItemDTO.cur < cur) { questItemDTO.cur = cur; isUpdate = true; } if (questItemDTO.cur >= condition[1] && questItemDTO.state == QuestStateConstVal.UNFINISH) { questItemDTO.state = QuestStateConstVal.CAN_RECEIVE; isUpdate = true; } } return(isUpdate); }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); RegisterListeners(); //处理离线奖励 double nowMills = DateTimeUtil.GetMills(DateTime.Now); offlineConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.OFFLINE_PARAMS); float count = (float)((nowMills - Global.gApp.gSystemMgr.GetMiscMgr().GetLastOffline()) / 1000) * float.Parse(offlineConfig.contents[0]); float limit = float.Parse(offlineConfig.contents[3]); if (count > limit) { count = limit; } m_AddItemDTO = new ItemDTO(Convert.ToInt32(offlineConfig.contents[2]), count, BehaviorTypeConstVal.OPT_OFFLINE); Itemvaluetxt.text.text = UiTools.FormateMoneyUP(count); m_ConsumeItemDTO = new ItemDTO(Convert.ToInt32(offlineConfig.contents[4]), float.Parse(offlineConfig.contents[5]), BehaviorTypeConstVal.OPT_OFFLINE); MoneyIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, m_ConsumeItemDTO.itemId)); AdText.text.text = "× " + offlineConfig.contents[7]; MoneyText.text.text = m_ConsumeItemDTO.num + " × " + offlineConfig.contents[6]; AdBtn.button.onClick.AddListener(OnAdBtn); MoneyBtn.button.onClick.AddListener(OnMoneyBtn); Btn1.button.onClick.AddListener(TouchClose); base.ChangeLanguage(); }
public int GetNextFreshTime() { GeneralConfigItem limitConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_LIMIT); int limit = int.Parse(limitConfig.content); if (m_Data.energy >= limit) { return(-1000); } double now = DateTimeUtil.GetMills(DateTime.Now); GeneralConfigItem freshConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_FRESH_SECONDS); GeneralConfigItem increaseTimeConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENEGRY_FRESH_PARAMS); int energyFreshParams = int.Parse(increaseTimeConfig.content) * 1000; int freshMills = int.Parse(freshConfig.content) * 1000; float curFreshTime = freshMills + energyFreshParams * m_Data.energy; double dtTime = (now - m_Data.lastEnergyTime); if (dtTime > curFreshTime) { FreshEnergy(); return(GetNextFreshTime()); } else { return((int)(curFreshTime - dtTime) / 1000); } }
public override string GetUnfinishTips(float[] condition) { int curPassId = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId(); GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); string tip = Global.gApp.gGameData.GetTipsInCurLanguage(3022); return(string.Format(tip, condition[1])); }
public override string GetMiddleUnfinishTips(float[] condition) { int curPassId = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId(); GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); string tip = Global.gApp.gGameData.GetTipsInCurLanguage(3061); //return string.Format(tipsConfig.txtcontent, condition[1] + int.Parse(initPassIdConfig.content) - curPassId + 1); return(string.Format(tip, condition[1])); }
public static void GenerateClassification(GeneralConfigItem config, string cacheFilename, GeneratedResultFileType type) { var jsonText = ""; if (type == GeneratedResultFileType.Json) { jsonText = GenerateClassificationJson(config, cacheFilename); } Console.WriteLine(jsonText); }
public override bool Filter(float[] condition) { int curPassId = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId(); GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); if (condition.Length > 1 && curPassId % Convert.ToInt32(initPassIdConfig.content) - 1 >= condition[1]) { return(true); } return(false); }
//检查配置,刷新 private void FreshQuestDTO(QuestDTO questDTO, GeneralConfigItem generalConfigItem) { List <QuestItem> questConfigs = Global.gApp.gGameData.QuestTypeMapData[questDTO.type]; int freshDay = int.Parse(generalConfigItem.contents[questDTO.type - 1]); DateTime lastFreshDay = GetLastFreshDay(questDTO.type); DateTime nowDate = DateTime.Today; int addDayNum = (nowDate - lastFreshDay).Days; if (freshDay > 0 && addDayNum >= 1) { foreach (QuestItem itemConfig in questConfigs) { //if (questDTO.questItemDTOMap.ContainsKey(itemConfig.quest_id.ToString())) //{ // QuestItemDTO itemDTO = questDTO.questItemDTOMap[itemConfig.quest_id.ToString()]; // itemDTO.state = QuestStateConstVal.UNFINISH; // itemDTO.cur = 0; //} else //{ // QuestItemDTO itemDTO = MakeQuestItemDTO(itemConfig); // questDTO.questItemDTOMap.Add(itemConfig.quest_id.ToString(), itemDTO); //} QuestItemDTO itemDTO; if (questDTO.questItemDTOMap.TryGetValue(itemConfig.quest_id.ToString(), out itemDTO)) { itemDTO.state = QuestStateConstVal.UNFINISH; itemDTO.cur = 0; } else { itemDTO = MakeQuestItemDTO(itemConfig); questDTO.questItemDTOMap.Add(itemConfig.quest_id.ToString(), itemDTO); } } questDTO.lastMills = DateTimeUtil.GetMills(nowDate); } else { foreach (QuestItem itemConfig in questConfigs) { if (!questDTO.questItemDTOMap.ContainsKey(itemConfig.quest_id.ToString())) { QuestItemDTO itemDTO = MakeQuestItemDTO(itemConfig); questDTO.questItemDTOMap.Add(itemConfig.quest_id.ToString(), itemDTO); } } } SaveData(); }
private void FlushUI() { GeneralConfigItem limitConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_LIMIT); float limit = float.Parse(limitConfig.content); float cur = (float)Global.gApp.gSystemMgr.GetBaseAttrMgr().GetEnergy(); float param = cur / limit * mMaxProgressParam; m_Pronum.image.rectTransform.sizeDelta = new Vector2(param > mMaxProgressParam ? mMaxProgressParam : param, mProgressY); string tmpEng = cur >= limit?string.Format("<color=#ff426c>{0}/{1}</color>", cur, limit) : string.Format("{0}/{1}", cur, limit);; m_Energytxt.text.text = tmpEng; }
public ItemDTO GetSkillUpdateItem() { GeneralConfigItem skillUpdateConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.SKILL_UPDATE); Skill_dataItem skillItemConfig = Global.gApp.gGameData.SkillDataConfig.Get(Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() + 1); if (skillItemConfig == null) { return(null); } int itemId = SpecialItemIdConstVal.GOLD; double cum = skillItemConfig.coinCost; return(new ItemDTO(itemId, cum, BehaviorTypeConstVal.OPT_SKILL_UPDATE)); }
private void InitNextUI(QuestItemDTO nextLevelDetailDTO, ItemItem itemConfig) { bool isWeapon = ItemTypeConstVal.isWeapon(itemConfig.showtype); //NextGunName.gameObject.SetActive(isWeapon); LDAGunIcon.gameObject.SetActive(itemConfig.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON); LDASubWpIcon.gameObject.SetActive(itemConfig.showtype == ItemTypeConstVal.SUB_WEAPON); LDAPetIcon.gameObject.SetActive(itemConfig.showtype == ItemTypeConstVal.PET); LDAAwardIcon.gameObject.SetActive(!isWeapon); List <GameObject> toDeleteList = new List <GameObject>(); LDAGunEffect.image.enabled = false; if (isWeapon) { GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); //NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[itemConfig.qualevel]); LDAGunName.text.text = FilterFactory.GetInstance().GetTinyUnfinishTips(itemConfig.opencondition); LDAGunIcon.image.sprite = Resources.Load(itemConfig.image_grow, typeof(Sprite)) as Sprite; LDASubWpIcon.image.sprite = Resources.Load(itemConfig.image_grow, typeof(Sprite)) as Sprite; LDAPetIcon.image.sprite = Resources.Load(itemConfig.image_grow, typeof(Sprite)) as Sprite; if (itemConfig.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { LDAGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, itemConfig.qualevel), typeof(Sprite)) as Sprite; } else { LDAGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } if (LDAGunEffect.rectTransform.childCount == 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = itemConfig.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? itemConfig.qualevel.ToString() : "common"; GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), LDAGunEffect.rectTransform); effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); } } else { QuestItem questCfg = Global.gApp.gGameData.QuestData.Get(nextLevelDetailDTO.id); LDAGunName.text.text = FilterFactory.GetInstance().GetTinyUnfinishTips(questCfg.condition); LDAAwardIcon.image.sprite = Resources.Load(questCfg.awardIcon, typeof(Sprite)) as Sprite; LDAGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } }
public static void GenerateDownload(GeneralConfigItem config, string outputDirectory) { if (!Directory.Exists(outputDirectory)) { Directory.CreateDirectory(outputDirectory); } var mailsync = new MailSync(config.Host, config.Port, config.Username, config.Password, config.MailBox, config.Assignments.Select(t => t.ConvertBack()).ToList()); config.Assignments.ToList().ForEach(a => { Directory.CreateDirectory(Path.Combine(outputDirectory, a.Name)); mailsync.Download(a.ConvertBack(), Path.Combine(outputDirectory, a.Name)); }); }
public override void ChangeLanguage() { base.ChangeLanguage(); GeneralConfigItem cfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.LANGUAGE_LIST); for (int i = 0; i < cfg.contents.Length; i += 3) { string lt = cfg.contents[i + 1]; if (lt.Equals(Global.gApp.gSystemMgr.GetMiscMgr().Language)) { Level1.Level1.languageTxt.text.text = cfg.contents[i]; break; } } }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); RegisterListeners(); m_Pass = arg as PassItem; GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); confirmtxt.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(4260), m_Pass.id % Convert.ToInt32(initPassIdConfig.content)); Btn1.button.onClick.AddListener(TouchClose); Btn2.button.onClick.AddListener(OnStartGame); base.ChangeLanguage(); }
private void Deal4Level(ItemItem itemConfig) { m_ItemConfig = itemConfig; int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(itemConfig.name); int gunShowLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponShowLevel(itemConfig.name); WeaponLvTxt.text.text = "lv: " + gunShowLevel; Guns_dataItem weaponLevelData = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); double[] paramValue; if (Global.gApp.gSystemMgr.GetWeaponMgr().GetQualityLv(m_ItemConfig) == 0) { paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name, weaponLevelData); double showVal = itemConfig.showParam / itemConfig.dtime * paramValue[0]; Param1Txt.text.text = UiTools.FormateMoney(showVal); } else { paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name + "_super", weaponLevelData); double showVal = itemConfig.showParam / itemConfig.dtime * paramValue[0]; Param1Txt.text.text = UiTools.FormateMoney(showVal); } m_WeaponName = itemConfig.name; int m_QualityLevel = itemConfig.qualevel; GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); WeaponNameTxt.text.color = ColorUtil.GetColor(colorConfig.contents[m_QualityLevel]); WeaponBg.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.WEAPON_BG_PATH, m_QualityLevel), typeof(Sprite)) as Sprite; if (m_QualityLevel > 0) { EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); GameObject effect = UiTools.GetEffect(string.Format(effectItem.path, m_QualityLevel), transform); if (mEffect != null) { GameObject.Destroy(mEffect); } mEffect = effect; mEffect.transform.SetParent(WeaponIcon.rectTransform, true); if (m_IconParentNode == null) { m_IconParentNode = WeaponIcon.gameObject.transform.parent; WeaponIcon.gameObject.GetComponent <WeaponUI_Item_Follow>().SetFollowNode(m_IconParentNode); WeaponIcon.gameObject.transform.SetParent(m_Parent.GetViewPoint2().transform, true); } } }
//初始化倒计时充值 private void InitCountdownPurchaseUI() { double mills = DateTimeUtil.m_Day_Mills * 7 - DateTimeUtil.GetMills(DateTime.Now) + Global.gApp.gSystemMgr.GetMiscMgr().TimeGiftStartTime; bool openTimeGift1 = Global.gApp.gSystemMgr.GetMiscMgr().IsShowTimeGift(mills, GeneralConfigConstVal.TIME_GIFT1_PRODUCT); if (openTimeGift1) { GeneralConfigItem timeGiftPassCfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.TIME_GIFT_SHOW_PASS); if (Global.gApp.gSystemMgr.GetMiscMgr().ShowTimeGiftToday == 0 && Global.gApp.gSystemMgr.GetPassMgr().GetPassSerial() > int.Parse(timeGiftPassCfg.content)) { OnTimeGift1(); Global.gApp.gSystemMgr.GetMiscMgr().ShowTimeGiftToday = 1; } } }
public int GetUserStep() { GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); int initId = Convert.ToInt32(initPassIdConfig.content); for (int i = 0; i < Global.gApp.gGameData.PassStep.Count; i++) { int start = i == 0 ? initId + 1 : Global.gApp.gGameData.PassStep[i - 1] + 1; int end = Global.gApp.gGameData.PassStep[i]; int curPassId = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId(); if (curPassId >= start && curPassId <= end) { return(i); } } return(0); }
private void FreshTime() { double nowMills = DateTimeUtil.GetMills(DateTime.Now); if (m_LastCheckMills + m_CheckMills > nowMills) { return; } m_LastCheckMills = nowMills; GeneralConfigItem limitConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_LIMIT); double limit = double.Parse(limitConfig.content); if (Global.gApp.gSystemMgr.GetBaseAttrMgr().GetEnergy() >= limit) { string tip = Global.gApp.gGameData.GetTipsInCurLanguage(3079); if (!tip.Equals(Timeneed.text.text)) { Timeneed.text.text = tip; } return; } GeneralConfigItem freshConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_FRESH_SECONDS); int freshMills = int.Parse(freshConfig.content) * 1000; double addNum = (nowMills - Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLastEnergyTime()) / freshMills; addNum = Math.Ceiling(addNum); DateTime nextDate = DateTimeUtil.GetDate(Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLastEnergyTime() + freshMills * addNum); double remainMills = Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLastEnergyTime() + freshMills * addNum - nowMills; int remainSeconds = (int)Math.Ceiling(remainMills / 1000); if (remainSeconds > 0 && m_CurRemainSeconds != remainSeconds) { m_CurRemainSeconds = remainSeconds; int hours = m_CurRemainSeconds / DateTimeUtil.m_Hour_Secs; int mimutes = (m_CurRemainSeconds % DateTimeUtil.m_Hour_Secs) / DateTimeUtil.m_Minute_Secs; int seconds = (m_CurRemainSeconds % DateTimeUtil.m_Hour_Secs) % DateTimeUtil.m_Minute_Secs; Timeneed.text.text = mimutes.ToString().PadLeft(2, '0') + ":" + seconds.ToString().PadLeft(2, '0'); } }
public bool NotHaveShowTimeGift(string key) { GeneralConfigItem timeGift1Cfg = Global.gApp.gGameData.GeneralConfigData.Get(key); string[] timeGift1Prm = timeGift1Cfg.content.Split('.'); ItemItem timeGift1Item = Global.gApp.gGameData.ItemData.Get(int.Parse(timeGift1Prm[2])); if (ItemTypeConstVal.isWeapon(timeGift1Item.showtype)) { return(GameItemFactory.GetInstance().GetItem(timeGift1Item.id) == 0d); } else { int times1 = 0; Global.gApp.gSystemMgr.GetMiscMgr().PurchaseTimesDic.TryGetValue(Global.gApp.gGameData.GeneralConfigData.Get(key).content, out times1); return(times1 == 0); } }
private void Deal4Level(ItemItem itemConfig) { int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(itemConfig.name); WeaponLvTxt.text.text = "lv: " + gunLevel; Guns_dataItem weaponLevelData = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); double[] costValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name + "_cost", weaponLevelData); CmNum.text.text = costValue[1].ToString(); CmIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, costValue[0])); m_ConsumItemId = (int)costValue[0]; double[] paramValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(itemConfig.name, weaponLevelData); Param1Txt.text.text = paramValue[0].ToString(); if (paramValue.Length <= 1) { Param2Txt.text.text = "None"; } else { Param2Txt.text.text = paramValue[1].ToString(); } m_WeaponName = itemConfig.name; int m_QualityLevel = itemConfig.qualevel; GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); WeaponNameTxt.text.color = ColorUtil.GetColor(colorConfig.contents[m_QualityLevel]); //if (m_QualityLevel < itemConfig.qualevel.Length - 1 && gunLevel - itemConfig.qualevel[m_QualityLevel] <= itemConfig.qualevel[m_QualityLevel + 1] - itemConfig.qualevel[m_QualityLevel]) //{ // LvPro.image.fillAmount = (float)(gunLevel - itemConfig.qualevel[m_QualityLevel]) / (itemConfig.qualevel[m_QualityLevel + 1] - itemConfig.qualevel[m_QualityLevel]); //} //else if (m_QualityLevel >= itemConfig.qualevel.Length - 1) //{ // LvPro.image.fillAmount = 0; //} //else //{ // LvPro.image.fillAmount = 1; //} }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); GeneralConfigItem cfg = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.LANGUAGE_LIST); BtnLanguage.gameObject.SetActive(false); for (int i = 0; i < cfg.contents.Length; i += 3) { LanguageConfigUI_BtnLanguage bl = BtnLanguage.GetInstance(); bl.Init(cfg.contents[i + 1], cfg.contents[i], this); bl.transform.SetSiblingIndex(i); m_list.Add(bl); } BtnC.button.onClick.AddListener(TouchClose); RegisterListeners(); ChangeLanguage(); }
public void AfterInit() { GeneralConfigItem generalConfigItem = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUEST_TYPE_FRESH_DAY); for (int type = 1; type <= generalConfigItem.contents.Length; type++) { if (m_Data.ContainsKey(type.ToString())) { FreshQuestDTO(m_Data[type.ToString()], generalConfigItem); } else { QuestDTO questDTO = MakeQuestDTO(type); m_Data.Add(type.ToString(), questDTO); } } SaveData(); }
public override bool ReduceItem(ItemDTO itemDTO) { if (!CanReduce(itemDTO)) { return(false); } itemDTO.num = -itemDTO.num; AddItem(itemDTO); //如果低于最高值,开始刷新 GeneralConfigItem limitConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.ENERGY_LIMIT); int limit = int.Parse(limitConfig.content); if (baseAttrMgr.GetEnergy() < limit) { baseAttrMgr.SetLastEnergyTime(DateTimeUtil.GetMills(DateTime.Now)); baseAttrMgr.SaveData(); } return(true); }