//Get a Ressourcesprite public Sprite getSprite(Ressources r) { if (r != (int)Ressources.None) return getSprite(r.ToString()); else return null; }
// GET: api/Balance/customerId public JsonResult <Ressources> Get(string id) { var errString = "The client does not exist. Please retry with a valid client id."; var balance = ServiceDictionary.AppService; try { var client = new Ressources { //CPU = id, //Memory = , //Message = "SUCCESS!" }; return(Json(client)); // return ClientBalance Object } catch (Exception ex) { return(Json(new Ressources { //CPU = id, //Memory = null, //Message = "FAILURE! " + errString + " " + ex.Message })); // return ClientBalance Object } }
public static Int32 currentRessources(Ressources f) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from ressources where code = '" + f.Code + "' and libelle = '" + f.Libelle + "'"; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); Int32 id = new Int32(); if (lect.HasRows) { while (lect.Read()) { id = (Int32)((lect["id"] != null) ? (!lect["id"].ToString().Trim().Equals("") ? lect["id"] : 0) : 0); } } return(id); } catch (NpgsqlException e) { Messages.Exception(e); return(0); } finally { Connexion.Deconnection(con); } }
public override void Render(RenderArgs args) { var prot = args.Prototype; var context = args.Context; var bounds = args.Bounds; var fg = Ressources.GetBrush((Color)prot.Parameter["ForeColor"].Value); var bg = Ressources.GetBrush((Color)prot.Parameter["BackColor"].Value); if (bg != null) { context.FillEllipse( new Ellipse( new Vector2(bounds.X + bounds.Width * 0.5f, bounds.Y + bounds.Height * 0.5f), bounds.Width * 0.5f, bounds.Height * 0.5f), bg); } if (fg != null) { context.DrawEllipse( new Ellipse( new Vector2(bounds.X + bounds.Width * 0.5f, bounds.Y + bounds.Height * 0.5f), bounds.Width * 0.5f, bounds.Height * 0.5f), fg); } }
public static List <Ressources> listRessources(string query) { NpgsqlConnection con = Connexion.Connection(); try { NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); List <Ressources> l = new List <Ressources>(); if (lect.HasRows) { while (lect.Read()) { Ressources y = oneRessources((Int32)((lect["id"] != null) ? (!lect["id"].ToString().Trim().Equals("") ? lect["id"] : 0) : 0)); l.Add(y); } } return(l); } catch (NpgsqlException e) { Messages.Exception(e); return(null); } finally { Connexion.Deconnection(con); } }
public static Ressources oneRessources(Int32 id) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from ressources where id = " + id; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); Ressources y = new Ressources(); if (lect.HasRows) { while (lect.Read()) { y.Id = id; y.Code = lect["code"].ToString(); y.Libelle = lect["libelle"].ToString(); } } return(y); } catch (NpgsqlException e) { Messages.Exception(e); return(null); } finally { Connexion.Deconnection(con); } }
private void dgv_ress_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { if (dgv_ress.Rows.Count > 0) { if (dgv_ress.CurrentRow.Cells["id_ress_"].Value != null) { Int32 id = (Int32)dgv_ress.CurrentRow.Cells["id_ress_"].Value; if (id > 0) { Ressources r = new Ressources(id); bool b = (bool)dgv_ress.CurrentRow.Cells[e.ColumnIndex].Value; AutorisationRessource a = AutorisationRessourceBLL.One(AutorisationRessourceBLL.Current(new AutorisationRessource(current, r, b))); if (a != null ? a.Id > 0 : false) { AutorisationRessourceBLL.Update(new AutorisationRessource(a.Id, current, r, b)); } else { AutorisationRessourceBLL.Save(new AutorisationRessource(current, r, b)); } } } } } catch (Exception ex) { Messages.Exception(ex); } }
static void Main(string[] args) { Ressources R = Ressources.Instance; // the number of factories // Graph graph = new Graph(factoryCount); // Game Initialization // ------------------- R.initGame(); // Game Loop // --------- while (true) { // Start Turn // ---------- { } // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); // Any valid action, such as "WAIT" or "MOVE source destination cyborgs" Console.WriteLine("WAIT"); // End of the turn // --------------- graph.clean(); } }
public void Mine() { // wait until acess to the mine is granted currentMine.EnteranceKey.WaitOne(); GameWorld.RemoveGameObject.Add(this); if (Bank.UpgradeTwo) { Thread.Sleep(2000); } else { Thread.Sleep(3000);//simulates the worker mining } foreach (GameObject item in GameWorld.GameObjectList) { if (item is Bank) { // i the case the was expanded to hold more than one bank add some code that desides the bank which bank is the neares GetBankDestination(item as Bank); } } carryingResource = true; carry = currentMine.Resources; position.X = currentMine.OriginPoint.X; position.Y = currentMine.OriginPoint.Y + (currentMine.OriginPoint.Y - currentMine.Position.Y); GameWorld.AddGameObject.Add(this); // releaser key so ohter members ca acces the mine currentMine.EnteranceKey.Release(); }
/* * Add ressources to the inventory. * If the the final value is out of the bounds of the inventory, the difference is given back * The bounds are not important for money */ public int addRessource(Ressources ressource, int number) { int currentNumber = ressources[(int)ressource]; ressources[(int)ressource] += number; if (ressource != Ressources.Money && ressources[(int)ressource] > capacity) { ressources[(int)ressource] = capacity; return(ressources[(int)ressource] + number - capacity); } else if (ressources[(int)ressource] < 0) { ressources[(int)ressource] = 0; return(currentNumber + number); } //Update the textFields for (int i = 0; i < numberRessourceTextFields; i++) { if (ressourcesTextFields1[(int)ressource] != null) { ressourcesTextFields1[(int)ressource].text = formatNumber(ressources[(int)ressource]); } if (ressourcesTextFields2[(int)ressource] != null) { ressourcesTextFields2[(int)ressource].text = formatNumber(ressources[(int)ressource]); } } return(0); }
void Awake() { logger = Logger.GetInstance(); jobsData = Jobs.GetInstance(); ressources = Ressources.GetInstance(); pView = GameObject.FindWithTag("Attackers").GetComponent<PhotonView>(); }
private void _listView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { _ressources = (Ressources)e.SelectedItem; _idRessources.Text = _ressources.id.ToString(); _titreEntry.Text = _ressources.titre; _contenuEntry.Text = _ressources.contenu; }
private int storeSize = 0; //Size of store #endregion Fields #region Methods public void actualizeText(Ressources id) { switch(id){ //Buildressources case Ressources.Wood: woodText.text = "" + getNumberOfRessource(id); woodText2.text = "" + getNumberOfRessource(id); break; case Ressources.Stone: stoneText.text = "" + getNumberOfRessource(id); stoneText2.text = "" + getNumberOfRessource(id); break; //Food case Ressources.Apple: appleText.text = "" + getNumberOfRessource(id); break; case Ressources.Fish: fishText.text = "" + getNumberOfRessource(id); break; case Ressources.Crop: cropText.text = "" + getNumberOfRessource(id); break; case Ressources.Flour: flourText.text = "" + getNumberOfRessource(id); break; } }
public Bot() { Champ = new Champ(); Ressources = new Ressources(); CentreDuVillage = new CentreDuVillage(); Carte = new Carte(); }
public static Ressources GetInstance() { if (instance == null) { instance = new Ressources(); } return instance; }
new void Awake() { base.Awake(); logger = Logger.GetInstance(); ressources = Ressources.GetInstance(); timerDeath = 0; this.RessourceName = Data.FOOD; }
public bool consommer(Ressources r, float quantite) { if (reserves [r] >= quantite) { reserves [r] -= quantite; return true; } else { return false; } }
public void postPushResources(Ressources r, RessourceReceiver pickUpModule) { Order o = new Order(null, r); o.pickUpModule = pickUpModule; orders.Add(o); ++amounts[r]; }
private bool ReserveRessource(Ressources cost, bool reserve = false) { currentRessources -= cost; if (reserve) { reservedRessources += cost; } return(true); }
public override void Render(RenderArgs args) { var url = args.Prototype.Parameter.ContainsKey("Url") ? args.Prototype.Parameter["Url"].Value as string : null; var bitmap = url == null ? null : Ressources.GetBitmap(url); if (bitmap != null) { args.Context.DrawBitmap(bitmap, args.Bounds, 1.0f, BitmapInterpolationMode.Linear); } }
public static Int32 Current(Ressources y) { try { return(RessourcesDAO.currentRessources(y)); } catch (Exception ex) { throw new Exception("Retour Impossible", ex); } }
public static Ressources Save(Ressources y) { try { return(RessourcesDAO.saveRessources(y)); } catch (Exception ex) { throw new Exception("Insertion Impossible", ex); } }
public static bool Update(Ressources y) { try { return(RessourcesDAO.updateRessources(y)); } catch (Exception ex) { throw new Exception("Modification Impossible", ex); } }
public static bool Delete(Ressources y) { try { return(RessourcesDAO.deleteRessources(y)); } catch (Exception ex) { throw new Exception("Suppression Impossible", ex); } }
private ContainerController getContainerWith(Ressources r) { foreach (ContainerController cc in containers) { if (cc.hasResource(r)) { return(cc); } } return(null); }
public void SaveButtonClickExecute(object obj) { string path = obj as string; if (path == null) { return; } System.IO.File.WriteAllText(path, Text); Ressources.reloadScript(path); }
public bool takeRessource(Ressources r, int amount) { if (amounts[r] >= amount) { amounts[r] -= amount; //Debug.Log("Gave " + amount + " " + r); return(true); } return(false); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Ressources.LoadImages(Content); Ressources.LoadSounds(Content); Ressources.LoadFonts(Content); gameOver = Ressources.Images["GameOver"]; mainMenuGfx = Ressources.Images["MainMenu"]; mainLevel.Load(Content); }
void Start() { List <string> all_ressources = Ressources.getAllRessources(); for (int i = 0; i < all_ressources.Count; i++) { ressourcesNeeded.Add(all_ressources[i], 0); } particule_system = GetComponentInChildren <ParticleSystem>(); current_obj = Instantiate(buildingEtapes[startingIndex.ToString()], transform.position, Quaternion.identity); }
private CrateBehavior getCrateOf(Ressources r) { foreach (CrateBehavior c in crates) { if (c.r == r) { return(c); } } return(null); }
private async void _button_Clicked(object sender, EventArgs e) { var db = new SQLiteConnection(_dbPath); Ressources ressources = new Ressources() { id = Convert.ToInt32(_idRessources.Text), titre = _titreEntry.Text, contenu = _contenuEntry.Text, }; db.Update(ressources); await Navigation.PopAsync(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { Content.RootDirectory = "Content"; // Charge les ressources (doit être fait après l'appel à BindGraphicsClients()).$ Ressources.LoadRessources(GraphicsDevice, Content); Ressources.ScreenSize = GetScreenSize(); m_batch = new SpriteBatch(Ressources.Device); m_renderer.ServerRemote = new ServerStateSnapshot(m_server); m_renderer.Viewport = new Rectangle(0, 0, (int)GameClient.GetScreenSize().X, (int)GameClient.GetScreenSize().Y); m_renderer.LoadContent(); m_controler.LoadContent(); }
public void LoadButtonClickExecute(object obj) { OpenFileDialog dial = new OpenFileDialog(); string path = null; dial.Filter = "Lua Script|*.lua"; dial.Title = "Select a Script"; if (System.Windows.Forms.DialogResult.OK == dial.ShowDialog()) { path = dial.FileName; } Ressources.loadScript(path); }
public void AddButtonClickExecute(object obj) { OpenFileDialog dial = new OpenFileDialog(); string path = null; dial.Filter = "All Files|*"; dial.Title = "Select a Texture"; if (System.Windows.Forms.DialogResult.OK == dial.ShowDialog()) { path = dial.FileName; } Ressources.addTexture(path); }
public override void Render(RenderArgs args) { var prot = args.Prototype; var context = args.Context; var bounds = args.Bounds; var x2 = prot.Parameter.ContainsKey("X2") ? (ScreenPos)prot.Parameter["X2"].Value : new ScreenPos(); var y2 = prot.Parameter.ContainsKey("Y2") ? (ScreenPos)prot.Parameter["Y2"].Value : new ScreenPos(); var fg = Ressources.GetBrush((Color)prot.Parameter["ForeColor"].Value); if (fg != null) { context.DrawLine(bounds.TopLeft, new Vector2(args.Transform(x2, false), args.Transform(y2, true)), fg); } }
private void EventUnitAdded(IUnit unit) { lock (_orders) { foreach (var o in _orders) { if (o.Unit?.UnitId != unit.UnitType) { continue; } if (o.Status != ProductionOrder.OrderStatus.Commissioned) { continue; } switch (o.Type) { case ProductionOrder.BuildType.AddOn: o.Status = ProductionOrder.OrderStatus.Producing; o.OrderedUnit = unit; return; case ProductionOrder.BuildType.Structure: o.Status = ProductionOrder.OrderStatus.Producing; o.OrderedUnit = unit; reservedRessources -= o.Unit; return; case ProductionOrder.BuildType.Unit: if (o.Position != null) { MoveUnit(unit, o.Position); } o.Status = ProductionOrder.OrderStatus.Built; return; case ProductionOrder.BuildType.Morphed: if (!IsStructure(o.Unit) && o.Position != null) { MoveUnit(unit, o.Position); } o.Status = ProductionOrder.OrderStatus.Built; return; case ProductionOrder.BuildType.Unknown: case ProductionOrder.BuildType.Research: throw new System.FormatException("Unexpected type!"); } } } }
public void addRessources(Ressources id, int value) { int idInt = (int)id; ressources[idInt] += value; //Die Anzahl einer Ressource darf nicht kleiner als 0 und nicht größer als die Lagergröße sein if(ressources[idInt] < 0) ressources[idInt] = 0; else if(ressources[idInt] > storeSize){ ressources[idInt] = storeSize; } //Actualize the text for the ressource id actualizeText(id); }
public int getNumberOfRessource(Ressources id) { return ressources[(int)id]; }
public Need(Ressources need, float numberPerInhabitant) { this.ressource = need; this.numberPerInhabitant = numberPerInhabitant; }
public EffetProduire(XmlNode node) { quantite = float.Parse(node.SelectSingleNode ("Quantite").InnerText); ressource = (Ressources) Enum.Parse (typeof(Ressources), node.SelectSingleNode ("Ressource").InnerText); }
public Cost(Ressources ressource, int number) { this.ressource = ressource; this.number = number; }
public void produire(Ressources r, float quantite) { reserves [r] += quantite; //Debug.Log ("Nouvelles réserves :" + reserves [r]); }
public float getQuantiteDeRessource(Ressources r) { return reserves[r]; }
void Awake() { updater = this.gameObject.GetComponent<IUpdatingStrategy>(); ressources = Ressources.GetInstance(); }
void Start() { ressourcesData = Ressources.GetInstance(); buildingsData = Buildings.GetInstance(); }