/// <summary> /// 删除网站资源 /// </summary> /// <param name="ProductId"></param> /// <param name="Type"></param> /// <param name="Addresses"></param> /// <param name="Sorts"></param> /// <returns></returns> public bool AddResources(string ProductId, ResourcesEnum Type, string[] Addresses, int[] Sorts) { int count = 0; int i = 0; foreach (string Address in Addresses) { Resources resources = new Resources { ProductID = ProductId, Type = Type, Address = Address, Sort = Sorts[i] }; i++; if (_db.Insertable(resources).ExecuteCommand() > 0) { count++; } else { return(false); } } if (count == Addresses.Count()) { return(true); } return(false); }
/// <summary> /// 批量删除网站资源 /// </summary> /// <param name="ProductId"></param> /// <param name="Type"></param> /// <returns></returns> public bool BatchDeleteResources(string ProductId, ResourcesEnum Type) { if (_db.Deleteable <Resources>().Where(a => a.ProductID == ProductId && a.Type == Type).ExecuteCommand() > 0) { return(true); } return(false); }
public int giveDepencyResources(ResourcesEnum r) { int d = 0; for (int i = 0; i < Session.messages.Count; i++) { if (Session.messages[i].state != MessageEnum.RECIEVE) { d = d + Session.messages[i].resourcesOwn[r]; } } return(d); }
public GameObject GetObj(ResourcesEnum type, string PrefabName, bool save = false) { string path = GetKay(type, PrefabName); GameObject obj = null; if (save) { if (ObjAry.ContainsKey(path)) { return(ObjAry[path] as GameObject); } } obj = Resources.Load <GameObject>(path); if (save) { ObjAry.Add(path, obj); } return(obj); }
public T GetObj <T>(ResourcesEnum type, string PrefabName, bool save) where T : Object { string path = GetKay(type, PrefabName); if (save) { if (ObjAry.ContainsKey(path)) { return(ObjAry[path] as T); } } T obj = Resources.Load <T>(path); if (save) { ObjAry.Add(path, obj); } return(obj); }
public static string ToInitial(ResourcesEnum r) { switch (r) { case ResourcesEnum.RED_CRYSTAL_KYBER: return("R"); case ResourcesEnum.GREEN_CRYSTAL_KYBER: return("G"); case ResourcesEnum.BLUE_CRYSTAL_KYBER: return("B"); case ResourcesEnum.VIOLET_CRYSTAL_KYBER: return("V"); default: return("NO_RESOURCE"); } }
public static string ToExplicitString(ResourcesEnum resource) { switch (resource) { case ResourcesEnum.RED_CRYSTAL_KYBER: return("Crystal Kyber rouge"); case ResourcesEnum.GREEN_CRYSTAL_KYBER: return("Crystal Kyber vert"); case ResourcesEnum.BLUE_CRYSTAL_KYBER: return("Crystal Kyber bleu"); case ResourcesEnum.VIOLET_CRYSTAL_KYBER: return("Crystal Kyber violet"); default: return("NO_RESOURCE"); } }
public bool UpdateResources(ResourceRequire resourceRequire) { ResourcesEnum resource = resourceRequire.resource; int updateVal = resourceRequire.updateVal; if (!resources.ContainsKey(resource)) { resources[resource] = 0; } if (resources[resource] + updateVal < 0 && OnResourcesLack != null) { OnResourcesLack.Invoke(this, resourceRequire);//当缺少资源 return(false); } else { resources[resource] += updateVal; if (OnUpdateSuccess != null) { OnUpdateSuccess.Invoke(this, EventArgs.Empty);//当更新成功资源 } return(true); } }
public static string Translate(this ResourcesEnum value) { string translatedResource = resourceManager.GetString(value.ToString()); return(translatedResource.CheckIsNull() ? string.Format(EmptyResourceFormat, value) : translatedResource); }
private Resources(ResourcesEnum @enum) { Value = @enum; }
public Sprite GetSprite(ResourcesEnum type, string name) { return(null); }
public string GetKay(ResourcesEnum type, string name) { return(_path[type] + name); }
/// <summary> /// 获取网站资源列表 /// </summary> /// <param name="ProductId"></param> /// <param name="Type"></param> /// <param name="total"></param> /// <returns></returns> public List <Resources> GetResourcesList(string ProductId, ResourcesEnum Type) { return(_db.Queryable <Resources>().Where(a => a.ProductID == ProductId && a.Type == Type).ToList()); }
public void SendResource(Vector3 initPos, Vector3 toPos, Player player, ResourcesManager toMan, ResourcesEnum resourcesEnum) //仅发送一个资源 { GameObject obj = Instantiate(resourceObj[resourcesEnum], initPos, Quaternion.identity); Emission entity = obj.GetComponent <Emission>(); entity.SetToWhere(toPos); entity.SetPlayer(player); entity.SetSpeed(0.1f);// entity.OnArrive += (object sender, System.EventArgs e) => { ResourceRequire _require = new ResourceRequire(); _require.resource = resourcesEnum; _require.updateVal = 1; toMan.UpdateResources(_require); }; }