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 void RefreshHud() { if (buildingGo == null || hudBinder == null) { return; } if (hudBinder == null) { return; } hudBinder.ClearHud(); NBuildingInfo info = sanctuaryPackage.GetBuildingInfo(buildingID); // check if can unlock or upgrade CheckIfCanUnlockOrUpgrade(); // int configID = 0; // if(info != null) // { // configID = info.configID; // if(sanctuaryPackage.GetBulidingLevelByConfigID(configID) < 20) // if(sanctuaryPackage.IsAbleToUnlockOrUpgrade(configID + 1)) // hudBinder.AddHud(HudType.Exmind); // } // else // { // configID = sanctuaryPackage.GetConfigIDByBuildingType(buildingType); // if(sanctuaryPackage.IsAbleToUnlockOrUpgrade(configID)) // hudBinder.AddHud(HudType.Exmind); // } if (info == null) { return; } BUILDING config = sanctuaryPackage.GetBuildingConfigDataByConfigID(info.configID); BuildingFunc func = sanctuaryPackage.GetBuildingFuncByConfigID(info.configID); if (mState == BuildingState.Collect) { // NDictionary args = new NDictionary(); // args.Add("id", config.ProId); // hudBinder.AddHud(HudType.Collect, args); } else if (mState == BuildingState.Upgrade) { NDictionary args = new NDictionary(); //NBuildingInfo info = sanctuaryPackage.GetBuildingInfo(buildingID); args.Add("finishtime", info.upgradeFinishTime); hudBinder.AddHud(HudType.CountDown, args); } if (func == BuildingFunc.Collect) { NDictionary args = new NDictionary(); var configMap = ConfigDataStatic.GetConfigDataTable("BAR_TIME"); BAR_TIME barConfig = configMap[sanctuaryPackage.GetBulidingLevelByConfigID(info.configID)] as BAR_TIME; args.Add("interval", (float)barConfig.BarTime / 1000f); // float speed = (float)sanctuaryPackage.GetProSpeed(info.configID) / 3600; // args.Add("speed", speed); // args.Add("num", info.number); args.Add("building", this); hudBinder.AddHud(HudType.ProduceBar, args); } //collect hud if (mState == BuildingState.Idle) { if (info.number > 0) { SetCollect(true); mState = BuildingState.Collect; } if (func == BuildingFunc.Collect) { if (collectCo != null) { StopCoroutine(collectCo); } collectCo = StartCoroutine(CollectTimer()); } } }