public void Setup(SimulationMixableBehavior currentItem, SimulationScrollListHandler currentScrollList) { MixtureItem = currentItem; // setup image and text try { var imageComponents = this.GetComponentsInChildren <Image>(); // don't look for components on the button itself, just on the children foreach (Image image in imageComponents) { if (image.gameObject != this.gameObject) { image.sprite = currentItem.icon; break; } } this.GetComponentInChildren <TextMeshProUGUI>().text = currentItem.itemName; } catch (NullReferenceException) { Debug.LogError(this.name + " button does not have an Image or Text child component"); } scrollList = currentScrollList; }
public List <SimulationMixableBehavior> GetSavedMixtures(SimulationMixableBehavior mixture) { if (!savedMixtures.ContainsKey(mixture)) { return(Enumerable.Empty <SimulationMixableBehavior>().ToList()); } return(savedMixtures[mixture]); }
public SimulationMixableBehavior(SimulationMixableBehavior otherItem) { this.itemName = otherItem.itemName; this.icon = otherItem.icon; this.itemId = otherItem.GetItemId(); //this.Parent = otherItem.Parent; this.MixButtonTitle = otherItem.MixButtonTitle; this.MinAllowableMix = otherItem.MinAllowableMix; this.AutoMix = otherItem.AutoMix; }
public bool AddAllowableMixtureToMixable(SimulationMixableBehavior mixture, SimulationMixableBehavior mixable) { if (!mixturePool.ContainsKey(mixture.GetItemId())) { Debug.LogError("Mixture " + mixture.GetItemId() + " is not registered"); return(false); } mixturePool[mixture.GetItemId()].Add(mixable); //MixableItem savedMixture = mixturePool[mixture.GetItemId()]; //savedMixture.mixables.Add(mixable); return(true); }
//public bool RegisterMixable(SimulationMixableBehavior mixable, Action<List<SimulationMixableBehavior>, DropZoneObjectHandler> action) //{ // return this.RegisterMixable(mixable) && this.RegisterMixAction(mixable, action); //} public bool RegisterMixable(SimulationMixableBehavior mixable) { if (mixturePool.ContainsKey(mixable.GetItemId())) { Debug.LogWarning("Mixture " + mixable.GetItemId() + " already registered"); return(false); } //var item = new MixableItem //{ // mixables = new HashSet<SimulationMixableBehavior>(), //}; mixturePool.Add(mixable.GetItemId(), new HashSet <SimulationMixableBehavior>()); return(true); }
public Cylinder(SimulationMixableBehavior otherItem) : base(otherItem) { }
public TestTube(SimulationMixableBehavior other) : base(other) { }
//public void AddList(List<SimulationMixableBehavior> list) //{ // if (list != null) // { // itemsList.AddRange(list); // RefreshDisplay(); // } //} public void AddItem(SimulationMixableBehavior item) { itemsList.Add(item); }
public ElectronicBalance(SimulationMixableBehavior otherItem) : base(otherItem) { }
public SodiumCarbonate(SimulationMixableBehavior otherItem) : base(otherItem) { }
public SodiumChloride(SimulationMixableBehavior otherItem) : base(otherItem) { }
public DistillationSetup(SimulationMixableBehavior otherItem) : base(otherItem) { }
public Filter(SimulationMixableBehavior otherItem) : base(otherItem) { }
public CoconutOil(SimulationMixableBehavior otherItem) : base(otherItem) { }
//public bool RegisterMixAction(SimulationMixableBehavior mixture, Action<List<SimulationMixableBehavior>, DropZoneObjectHandler> action) //{ // if (!mixturePool.ContainsKey(mixture.GetItemId())) // { // Debug.LogError("Mixture " + mixture.GetItemId() + " is not registered"); // return false; // } // MixableItem savedMixture = mixturePool[mixture.GetItemId()]; // savedMixture.doMixAction = action; // return true; //} #endregion #region Public Methods public bool IsMixable(SimulationMixableBehavior targetMixture, SimulationMixableBehavior mixable) { return(mixturePool.ContainsKey(targetMixture.GetItemId()) && mixturePool[targetMixture.GetItemId()].FirstOrDefault(m => m.GetItemId() == mixable.GetItemId()) != null); //mixturePool[targetMixture.GetItemId()].mixables.FirstOrDefault(a => a.GetItemId() == mixable.GetItemId()) != null; }
public IronStand(SimulationMixableBehavior otherItem) : base(otherItem) { }
public GlassTube(SimulationMixableBehavior other) : base(other) { }
public WatchGlass(SimulationMixableBehavior otherItem) : base(otherItem) { }
public Charcoal(SimulationMixableBehavior otherItem) : base(otherItem) { }
public HydrochloricAcid(SimulationMixableBehavior otherItem) : base(otherItem) { }
public AmmoniumHydroxide(SimulationMixableBehavior otherItem) : base(otherItem) { }
public Thermometer(SimulationMixableBehavior otherItem) : base(otherItem) { }
public FunnelSupport(SimulationMixableBehavior otherItem) : base(otherItem) { }
public void AddEquipmentItem(SimulationMixableBehavior item) { equipmentsScrollList.GetComponent <SimulationScrollListHandler>().AddItem(item); }
public Spatula(SimulationMixableBehavior otherItem) : base(otherItem) { }
public void AddMaterial(SimulationMixableBehavior item) { materialsScrollList.GetComponent <SimulationScrollListHandler>().AddItem(item); }
public Phenolphthalein(SimulationMixableBehavior otherItem) : base(otherItem) { }
public void SetParents(GameObject gameObject, SimulationMixableBehavior mixtureItem) { this.parentObject = gameObject; this.parentItem = mixtureItem; }
public Ice(SimulationMixableBehavior otherItem) : base(otherItem) { }
public BoilSetup(SimulationMixableBehavior otherItem) : base(otherItem) { }