//! 获取资源转换 //public IResource GetResource(IResource resource, int time, int timeType) //{ // int total = 0; // if (resource != null) // { // foreach (int type in resource.GetTypeSet()) // { // switch (type) // { // case AWEnum.ResourceType.Medal: // total += resource.Get(type); // break; // default: // string resourceParamName = resourceTypeToParamName[type]; // double resourceA = Conf.GetInstance().GlobalValueDouble(resourceParamName + "ParamA"); // double resourceB = Conf.GetInstance().GlobalValueDouble(resourceParamName + "ParamB"); // double resourceK = Conf.GetInstance().GlobalValueDouble(resourceParamName + "ParamK"); // total += CalculateMedalFormula(resource.Get(type), resourceA, resourceB, resourceK); // break; // } // } // } // string timeParamName = timeTypeToParamName[timeType]; // double timeA = Conf.GetInstance().GlobalValueDouble(timeParamName + "ParamA"); // double timeB = Conf.GetInstance().GlobalValueDouble(timeParamName + "ParamB"); // double timeK = Conf.GetInstance().GlobalValueDouble(timeParamName + "ParamK"); // total += CalculateMedalFormula(UnityEngine.Mathf.CeilToInt(time / 60.0f), timeA, timeB, timeK); // return new Resource(AWEnum.ResourceType.Medal, total); //} public IResource GetResource(IResource resource, int time, int timeType) //! 获取资源转换 public IResource GetResource(IResource resource, int time, int timeType = 0) { //if (Newbie.GetNewbieStatus() == 14) //{ // return new Resource(AWEnum.ResourceType.Medal, 0); //} int total = 0; if (resource != null) { foreach (int type in resource.GetTypeSet()) { int count = resource.Get(type); switch (type) { case AWEnum.ResourceType.Medal: total += count; break; case AWEnum.ResourceType.Steel: if (count > 0) { total += DataSave.CalcMoney2Medal(count); } break; default: break; } } } if (time > 0) { switch (timeType) { case AWEnum.ImmediateTimeType.Repair: total += DataSave.CalcUnitTime2Medal(time); break; case AWEnum.ImmediateTimeType.Upgrade: total += DataSave.CalcBuildingTime2Medal(time); break; default: break; } } return(new Resource(AWEnum.ResourceType.Medal, total)); }