Ejemplo n.º 1
0
    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;
    }
Ejemplo n.º 2
0
    public List <SimulationMixableBehavior> GetSavedMixtures(SimulationMixableBehavior mixture)
    {
        if (!savedMixtures.ContainsKey(mixture))
        {
            return(Enumerable.Empty <SimulationMixableBehavior>().ToList());
        }

        return(savedMixtures[mixture]);
    }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
    //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);
    }
Ejemplo n.º 6
0
 public Cylinder(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 7
0
 public TestTube(SimulationMixableBehavior other) : base(other)
 {
 }
Ejemplo n.º 8
0
    //public void AddList(List<SimulationMixableBehavior> list)
    //{
    //    if (list != null)
    //    {
    //        itemsList.AddRange(list);

    //        RefreshDisplay();
    //    }
    //}

    public void AddItem(SimulationMixableBehavior item)
    {
        itemsList.Add(item);
    }
Ejemplo n.º 9
0
 public ElectronicBalance(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 10
0
 public SodiumCarbonate(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 11
0
 public SodiumChloride(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 12
0
 public DistillationSetup(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 13
0
 public Filter(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 14
0
 public CoconutOil(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 15
0
    //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;
    }
Ejemplo n.º 16
0
 public IronStand(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 17
0
 public GlassTube(SimulationMixableBehavior other) : base(other)
 {
 }
Ejemplo n.º 18
0
 public WatchGlass(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 19
0
 public Charcoal(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 20
0
 public HydrochloricAcid(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 21
0
 public AmmoniumHydroxide(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 22
0
 public Thermometer(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 23
0
 public FunnelSupport(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 24
0
 public void AddEquipmentItem(SimulationMixableBehavior item)
 {
     equipmentsScrollList.GetComponent <SimulationScrollListHandler>().AddItem(item);
 }
Ejemplo n.º 25
0
 public Spatula(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 26
0
 public void AddMaterial(SimulationMixableBehavior item)
 {
     materialsScrollList.GetComponent <SimulationScrollListHandler>().AddItem(item);
 }
Ejemplo n.º 27
0
 public Phenolphthalein(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 28
0
 public void SetParents(GameObject gameObject, SimulationMixableBehavior mixtureItem)
 {
     this.parentObject = gameObject;
     this.parentItem   = mixtureItem;
 }
Ejemplo n.º 29
0
 public Ice(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Ejemplo n.º 30
0
 public BoilSetup(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }