public void Initialize(NDictionary args) { SanctuaryPackage sanctuaryPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Sanctuary) as SanctuaryPackage; int configID = args.Value <int>("id"); bool isUnlock = args.Value <bool>("isunlock"); UILabel label = transform.Find("label").GetComponent <UILabel>(); BUILDING config = ConfigDataStatic.GetConfigDataTable("BUILDING")[configID] as BUILDING; if (isUnlock == true) { label.text = string.Format("{0} Lv.{1}", config.BldgName, sanctuaryPackage.GetBulidingLevelByConfigID(configID)); } else { UserPackage userPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_User) as UserPackage; int curLevel = userPackage.GetManorLevel(); int requireLevel = config.BldgLvLim; if (curLevel >= requireLevel) { label.text = string.Format("[90FF15]可解锁[-]"); } else { label.text = string.Format("庄园Lv.{0} 解锁", requireLevel); } } name = config.BldgName; }
void InitView() { NBuildingInfo info = sanctuaryPackage.GetSelectionBuildingInfo(); BUILDING configData = null; BUILDING nextConfigData = null; if (info == null) //unlock { Building building = sanctuaryPackage.GetSelectionBuilding(); int configID = sanctuaryPackage.GetConfigIDByBuildingType(building.buildingType); nextConfigData = sanctuaryPackage.GetBuildingConfigDataByConfigID(info.configID); titleLabel.text = string.Format("{0} 升级", nextConfigData.BldgName); preLevelLabel.text = string.Format("Lv.{0}", 0); nextLevelLabel.text = string.Format("Lv.{0}", sanctuaryPackage.GetBulidingLevelByConfigID(configID)); } else { configData = sanctuaryPackage.GetBuildingConfigDataByConfigID(info.configID); nextConfigData = sanctuaryPackage.GetBuildingConfigDataByConfigID(info.configID + 1); titleLabel.text = string.Format("{0} 升级", configData.BldgName); preLevelLabel.text = string.Format("Lv.{0}", sanctuaryPackage.GetBulidingLevelByConfigID(info.configID)); nextLevelLabel.text = string.Format("Lv.{0}", sanctuaryPackage.GetBulidingLevelByConfigID(info.configID + 1)); } titleLabel.text = string.Format("{0} 升级", configData.BldgName); preLevelLabel.text = string.Format("Lv.{0}", sanctuaryPackage.GetBulidingLevelByConfigID(info.configID)); nextLevelLabel.text = string.Format("Lv.{0}", sanctuaryPackage.GetBulidingLevelByConfigID(info.configID + 1)); //set icon preIcon.spriteName = configData.IconName; nextIcon.spriteName = nextConfigData.IconName; //show cost int level = nextConfigData.BldgLvLim; levelLabel.text = string.Format("庄园等级限制: {0}", level); int curLevel = userPackage.GetManorLevel(); if (level > curLevel) { levelLabel.color = Color.red; } else { levelLabel.color = Color.white; } //levelLabel.text ShowCost(nextConfigData); //show upgrade effect ShowUpgradeEffect(info); //set point if (info.building.CanUnlockOrUpgrade) { pointGo.SetActive(true); } else { pointGo.SetActive(false); } }
void InitView(NDictionary data = null) { manorExpProgress.value = 0; IDLabel.text = userPackage.GroupID.ToString(); float progress = 0f; levelLabel.text = string.Format("Lv.{0}", userPackage.GetManorLevel(out progress).ToString()); nameLabel.text = userPackage.GetGroupName(); manorExpProgress.value = 1 - progress; ShowEventIcon(); }
void ShowSelf() { nameLabel.text = userPackage.GetGroupName(); levelLabel.text = string.Format("Lv.{0}", userPackage.GetManorLevel()); contributionLabel.text = string.Format("实力:{0}", userPackage.GetTotalContribution()); int count = 0; var userMap = userPackage.GetUserInfoMap(); foreach (var pair in userMap) { NUserInfo info = pair.Value; playerInofs[count].nameLabel.text = info.name; } }
void RefreshProduceBar(NDictionary data = null) { //get produce interval int level = userPackage.GetManorLevel(); if (level <= 1) { proInterval = 0; return; } BAR_TIME config = ConfigDataStatic.GetConfigDataTable("BAR_TIME")[level] as BAR_TIME; proInterval = (float)config.BarTime / 1000f; }
public bool IsAbleToUnlockOrUpgrade(int configID) { int requireVal; double curVal; ItemPackage itemPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Item) as ItemPackage; UserPackage userPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_User) as UserPackage; BUILDING config = GetBuildingConfigDataByConfigID(configID); //level requireVal = config.BldgLvLim; curVal = userPackage.GetManorLevel(); if (curVal < requireVal) { return(false); } //gold cost requireVal = config.GoldCost; curVal = itemPackage.GetGoldNumber(); if ((double)requireVal > curVal) { return(false); } //item for (int i = 0; i < config.CostTableCount; i++) { var cost = config.GetCostTable(i); if (cost.CostId == 0) { continue; } requireVal = cost.CostQty; NItemInfo info = itemPackage.GetItemInfo(cost.CostId); // ITEM_RES itemConfig = itemPackage.GetItemDataByConfigID(cost.CostId); // if(itemConfig == null) // { // Debug.Log(string.Format("configID = {0} missing!!!", cost.CostId)); // continue; // } if (info == null || info.number < cost.CostQty) { return(false); } } return(true); }
public bool IsBuildingVisible(BuildingType type) { UserPackage userPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_User) as UserPackage; float progress; int level = userPackage.GetManorLevel(out progress); int configID = GetConfigIDByBuildingType(type); BUILDING data = GetBuildingConfigDataByConfigID(configID); if (type == BuildingType.ConcreteFactory) { Debug.Log(string.Format("name{0} level{1}", data.BldgName, data.BldgVisible)); } if (level >= data.BldgVisible) { return(true); } else { return(false); } }
public override void DrawCell(int index, int count = 0) { base.DrawCell(index, count); var dataList = sanctuaryPackage.GetBuildingCostList(); NCostDef cost = dataList[index]; bool isEnough = true; if (cost.configID == 1) { nameLabel.text = string.Format("庄园等级限制:"); valueLabel.text = string.Format("{0}/{1}", cost.value, userPackage.GetManorLevel()); if (userPackage.GetManorLevel() < cost.value) { isEnough = false; } } else if (cost.configID == 2) { nameLabel.text = string.Format("黄金:"); valueLabel.text = string.Format("{0}/{1}", cost.value, GlobalFunction.NumberFormat(itemPackage.GetGoldNumber())); if (itemPackage.GetGoldNumber() < cost.value) { isEnough = false; } } else if (cost.configID == 3) { nameLabel.text = string.Format("电力:"); valueLabel.text = string.Format("{0}/{1}", cost.value, GlobalFunction.NumberFormat(itemPackage.GetElecNumber())); if (itemPackage.GetElecNumber() < cost.value) { isEnough = false; } } else { ITEM_RES itemData = itemPackage.GetItemDataByConfigID(cost.configID); if (itemData == null) { return; } nameLabel.text = string.Format("{0}:", itemData.MinName); NItemInfo itemInfo = itemPackage.GetItemInfo(cost.configID); if (itemInfo == null) { valueLabel.text = string.Format("{0}/{1}", cost.value, 0); isEnough = false; } else { valueLabel.text = string.Format("{0}/{1}", cost.value, GlobalFunction.NumberFormat(itemInfo.number)); if (itemInfo.number < cost.value) { isEnough = false; } } } if (isEnough) { nameLabel.color = Color.white; valueLabel.color = Color.white; } else { nameLabel.color = Color.red; valueLabel.color = Color.red; } }