Пример #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;
    }
Пример #2
0
    public List <SimulationMixableBehavior> GetSavedMixtures(SimulationMixableBehavior mixture)
    {
        if (!savedMixtures.ContainsKey(mixture))
        {
            return(Enumerable.Empty <SimulationMixableBehavior>().ToList());
        }

        return(savedMixtures[mixture]);
    }
Пример #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;
 }
Пример #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);
    }
Пример #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);
    }
Пример #6
0
 public Cylinder(SimulationMixableBehavior otherItem) : base(otherItem)
 {
 }
Пример #7
0
 public TestTube(SimulationMixableBehavior other) : base(other)
 {
 }
Пример #8
0
    //public void AddList(List<SimulationMixableBehavior> list)
    //{
    //    if (list != null)
    //    {
    //        itemsList.AddRange(list);

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

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