private void AnyButton_MosueDown(object sender, MouseEventArgs e) { Button btn = (Button)sender; btn.Focus(); MOType mt = (MOType)(((object[])(btn.Tag))[0]); FOType ft = (FOType)(((object[])(btn.Tag))[1]); if (e.Button == MouseButtons.Left) { if (mt == MOType.Belt) { if (Utilz.IsBeltable(ft)) //we set addmode only if the item can be a belt { MapObject newmo = new MapObject(mt, ft); this.Editer.StartAddMode(newmo); } } if (mt == MOType.Machine) //we set addmode only if the item can be a machine { if (Utilz.IsRecipe(ft)) { MapObject newmo = new MapObject(mt, ft); this.Editer.StartAddMode(newmo); } } } if (e.Button == MouseButtons.Right) { FOType[] arrayOutputs = Utilz.GetRecipeOutputs(ft); FOType[] arrayInputs = Utilz.GetRecipeInputs(ft); oRightClick3 rc = new oRightClick3(); //rc.Width = 200; rc.AddChoice(ft.ToString()); rc.AddSeparator(); rc.AddSeparator(); //add every outputs and inputs for the user rc.AddChoice("Outputs :"); foreach (FOType subft in arrayOutputs) { rc.AddChoice("-" + subft.ToString()); } rc.AddChoice(""); rc.AddChoice("Inputs :"); foreach (FOType subft in arrayInputs) { rc.AddChoice("-" + subft.ToString()); } rc.ShowDialog(); } }
//public MapObject(MOType StartMapType, FOType[] StartOutputs) //{ // this.MapType = StartMapType; // this.SetOutput(StartOutputs); // if (this.MapType == MOType.Machine) // { // this.SetRecipe(StartOutputs[0]); // } //} //define inputs and outputs according to the recipe //// défini les input et output qui vont avec la recette spécifié public void SetRecipe(FOType Recipe) { if (this.MapType == MOType.Belt) { this.SetOutput(Recipe); } if (this.MapType == MOType.Machine) { this.TheRecipe = Recipe; this.Outputs = Utilz.GetRecipeOutputs(Recipe); this.Inputs = Utilz.GetRecipeInputs(Recipe); this.IsFurnace = Utilz.IsRecipeMadeInFurnace(Recipe); } }
//define inputs and outputs according to the recipe //// défini les input et output qui vont avec la recette spécifié public void SetRecipe(FOType Recipe) { if (this.MapType == MOType.Belt) //SetRecipe is usually not called for belts { this.BeltOutput = Recipe; } if (this.MapType == MOType.Machine) { //set the recipe and set everything this.TheRecipe = Recipe; this.Outputs = Utilz.GetRecipeOutputs(Recipe); this.Inputs = Utilz.GetRecipeInputs(Recipe); this.IsFurnace = Utilz.IsRecipeMadeInFurnace(Recipe); } }