public TimelinePropertyViewModel(LayerProperty <T> layerProperty, LayerPropertyViewModel layerPropertyViewModel, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerProperty = layerProperty; LayerPropertyViewModel = layerPropertyViewModel; }
public bool Popups(LayerProperty layerProperty) { // get layer info layer = layerProperty; type = layer.type; name = layer.gameObject.name; shape = DataManager.instance.GetLayerShape(name); shelfupdated = false; //to check if the shelf is updated. // check if layer is revealed isRevealed = checkRevealed(name); if (isRevealed) { // current layer Invoke("Wait", 4); rockCount++; return(true); } else { Debug.Log("print name is"); Debug.Log(layer.GetPrintName()); Invoke("WaitNotRevealed", 4); rockCount++; return(false); } }
public IntRangePropertyInputViewModel(LayerProperty <IntRange> layerProperty, IProfileEditorService profileEditorService, IModelValidator <IntRangePropertyInputViewModel> validator) : base(layerProperty, profileEditorService, validator) { _startRegistration = layerProperty.GetDataBindingRegistration <int>("Start"); _endRegistration = layerProperty.GetDataBindingRegistration <int>("End"); }
private void LoadCardInfo(int i) { if (layers[i] != null) // just to be safe { notRevealedCard.SetActive(false); LayerProperty current = layers[i]; //LayerType currentType = current.type; String layerName = current.GetPrintName(); if (isNone[i]) { // swap to other card notRevealedCard.SetActive(true); String printName = "Not Revealed"; rock.sprite = GetSpriteByName(printName); number.text = (i + 1).ToString(); } else { name.text = current.GetPrintName(); permeability.text = current.GetPorosity().ToString() + " %"; density.text = current.GetDensity().ToString() + " kg/m^3"; probability.text = String.Format("{0:F0}", current.GetPossibility()) + " %"; // format to chop off extra decimals number.text = (i + 1).ToString(); rock.sprite = GetSpriteByName(current.GetPrintName()); } } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "layer") { layerProperty = other.gameObject.GetComponent <LayerProperty> (); } }
public void Show() { object[] samples = DataManager.instance.GetCollectedSamples(); string layerName = ((CoreSample)samples[entryNumber]).layername; Color layerColor = DataManager.instance.GetColorOfLayerName(layerName); GameObject orgLayer = GameObject.Find("/Layers/" + layerName); LayerProperty property = orgLayer.GetComponent <LayerProperty> (); LayerType type = property.type; if (type == LayerType.Oil) { current = oil; } else if (type == LayerType.HardLayer) { current = hard; } else if (type == LayerType.SoftLayer) { current = soft; } layerNum.text = "Sample: " + string.Format("{0:0}", (entryNumber + 1)); current.enabled = true; if (DataManager.instance.IfLayerRevealed(layerName)) { current.color = layerColor; } }
public BrushPropertyInputViewModel(LayerProperty <LayerBrushReference> layerProperty, IProfileEditorService profileEditorService, IPluginManagementService pluginManagementService, IDialogService dialogService) : base(layerProperty, profileEditorService) { _pluginManagementService = pluginManagementService; _dialogService = dialogService; UpdateEnumValues(); }
public TreePropertyViewModel(LayerProperty <T> layerProperty, LayerPropertyViewModel layerPropertyViewModel, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerProperty = layerProperty; LayerPropertyViewModel = layerPropertyViewModel; PropertyInputViewModel = _profileEditorService.CreatePropertyInputViewModel(LayerProperty); PropertyInputViewModel.ConductWith(this); }
public bool Popups(LayerProperty layerProperty) { layer = layerProperty; type = layer.type; name = layer.gameObject.name; object[] layers = DataManager.instance.GetRevealedLayers(); // can redo this just using the is revealed function for (int i = 0; i < layers.Length; i++) { if (layers [i].ToString() == name.Trim()) { isRevealed = true; } } if (isRevealed) { //Score.score -= 100; // DataManager.instance.AddCollectedSamples(name); Adarsh has this already spawnTime = Time.time; // deal with sampling while popup already open if (open == true) { Destroy(clone); } else { open = true; } layerColor = DataManager.instance.GetColorOfType(type); if (type == LayerType.Oil) { clone = Instantiate(shale) as GameObject; } else if (type == LayerType.SoftLayer) { clone = Instantiate(soft) as GameObject; } else if (type == LayerType.HardLayer) { clone = Instantiate(hard) as GameObject; } if (DataManager.instance.IfLayerRevealed(name) == true) { clone.GetComponentInChildren <SpriteRenderer> ().color = layerColor; } isRevealed = false; return(true); } else { Debug.Log("Too Bad!!!!Not Revealed Layer"); return(false); } }
public BrushPropertyInputViewModel(LayerProperty <LayerBrushReference> layerProperty, IProfileEditorService profileEditorService, IPluginService pluginService) : base(layerProperty, profileEditorService) { _pluginService = pluginService; _pluginService.PluginEnabled += PluginServiceOnPluginLoaded; _pluginService.PluginDisabled += PluginServiceOnPluginLoaded; UpdateEnumValues(); }
protected PropertyInputViewModel(LayerProperty <T> layerProperty, IProfileEditorService profileEditorService, IModelValidator validator) : base(validator) { LayerProperty = layerProperty; ProfileEditorService = profileEditorService; LayerProperty.Updated += LayerPropertyOnUpdated; LayerProperty.CurrentValueSet += LayerPropertyOnUpdated; LayerProperty.DataBindingEnabled += LayerPropertyOnDataBindingChange; LayerProperty.DataBindingDisabled += LayerPropertyOnDataBindingChange; UpdateInputValue(); }
public TimelinePropertyViewModel(LayerProperty <T> layerProperty, LayerPropertyViewModel layerPropertyViewModel, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerProperty = layerProperty; LayerPropertyViewModel = layerPropertyViewModel; LayerProperty.KeyframesToggled += LayerPropertyOnKeyframesToggled; LayerProperty.KeyframeAdded += LayerPropertyOnKeyframeAdded; LayerProperty.KeyframeRemoved += LayerPropertyOnKeyframeRemoved; UpdateKeyframes(); }
public Texture GetTextureOfLayerName(string layername) { LayerProperty property = GetLayerProperty(layername); if (property != null) { return(GetTextureOfType(property.type)); } else { return(null); } }
void GetLayerProperty() { object[] samples = DataManager.instance.GetCollectedSamples(); foreach (string layername in samples) { GameObject orgLayer = GameObject.Find("/Layers/" + layername); if (orgLayer != null) { LayerProperty propertyScript = orgLayer.GetComponent <LayerProperty> (); } } }
public TreePropertyViewModel(LayerProperty <T> layerProperty, LayerPropertyViewModel layerPropertyViewModel, IProfileEditorService profileEditorService) { _profileEditorService = profileEditorService; LayerProperty = layerProperty; LayerPropertyViewModel = layerPropertyViewModel; PropertyInputViewModel = _profileEditorService.CreatePropertyInputViewModel(LayerProperty); _profileEditorService.SelectedDataBindingChanged += ProfileEditorServiceOnSelectedDataBindingChanged; LayerProperty.VisibilityChanged += LayerPropertyOnVisibilityChanged; LayerProperty.DataBindingEnabled += LayerPropertyOnDataBindingChange; LayerProperty.DataBindingDisabled += LayerPropertyOnDataBindingChange; LayerPropertyViewModel.IsVisible = !LayerProperty.IsHidden; }
private bool TryAddToLayerList(MaterialProperty mp) { string s = mp.name; if (!s.StartsWith(prefix) && !s.StartsWith(upperPrefix)) { return(false); } string idStr = mp.name.Substring(prefix.Length, 1); int id; if (!int.TryParse(idStr, out id)) { return(false); } MaterialProperty[] layer; if (!dict.TryGetValue(id, out layer)) { layer = new MaterialProperty[(int)LayerProperty.Max]; dict.Add(id, layer); } bool result = false; if (s.Length == prefix.Length + 1) { layer[(int)LayerProperty.IsEnable] = mp; if (mp.floatValue == 1) { maxLayer = id; } result = true; } else { string type = s.Substring(prefix.Length + 2); if (System.Enum.IsDefined(typeof(LayerProperty), type)) { LayerProperty lp = (LayerProperty)System.Enum.Parse(typeof(LayerProperty), type); layer[(int)lp] = mp; result = true; } } return(result); }
set => SetValue(LayerProperty, value);
set { SetValue(LayerProperty, value); }
// Use this for initialization public void InitJars() { samples = DataManager.instance.GetCollectedSamples(); size = samples.Length; Debug.Log("size"); Debug.Log(size); if (size > 0) { GameObject emptyCard = GameObject.Find("Empty Info"); emptyCard.SetActive(false); // cannot find inactive game objects - must handle here. notRevealedCard = GameObject.Find("Not Revealed Info"); notRevealedCard.SetActive(false); //jars = gameObject.GetComponentsInChildren<Image>(); for (int i = 0; i < size; i++) { // get layers string layerName = ((CoreSample)samples[i]).layername; string printName = ""; if (layerName == "None") { printName = "Not Revealed"; isNone[i] = true; } else { orgLayer = GameObject.Find(layerName); layer = orgLayer.GetComponent <LayerProperty> (); type = layer.type; printName = layer.GetPrintName(); isNone[i] = false; } layers[i] = layer; // add correct number of jars to list and enable them GameObject thisJar = GameObject.Find("Jar" + (i + 1).ToString()); Image thisJarImage = thisJar.GetComponent <Image>(); thisJarImage.enabled = true; jars[i] = thisJarImage; // add correct number of rocks to list, enable them, and set to right texture GameObject thisRock = GameObject.Find("Rock" + (i + 1).ToString()); Image thisRockImage = thisRock.GetComponent <Image>(); thisRockImage.sprite = GetSpriteByName(printName); thisRockImage.enabled = true; smallRocks[i] = thisRockImage; // add correct text to list, enable them, set to right name GameObject thisText = GameObject.Find("Text" + (i + 1).ToString()); Text thisTextText = thisText.GetComponent <Text>(); thisTextText.text = printName; thisTextText.enabled = true; labels[i] = thisTextText; // old stuff //Color color = DataManager.instance.GetColorOfLayerName (layerName); //jars[i+1].enabled = true; // jars has shelf first so index is 1 up //jars[i+1].color = color; // might be able to just do this using layer properties. check later. //colors[i] = color; } //jars[index+1].enabled=false; // jars[0] is the shelf jars[0].sprite = missingJar; smallRocks[0].enabled = false; //rock.color = jars[index+1].color; // make rock correct color LoadCardInfo(0); } else { rock.enabled = false; // no rock if no samples GameObject regCard = GameObject.Find("Info"); regCard.SetActive(false); } }
public bool HasBeenSampled() { LayerProperty layerS = layerScripts [0] as LayerProperty; return(DataManager.instance.LayerHasBeenSampled(layerS.name)); }
public SKSizePropertyInputViewModel(LayerProperty <SKSize> layerProperty, IProfileEditorService profileEditorService, IModelValidator <SKSizePropertyInputViewModel> validator) : base(layerProperty, profileEditorService, validator) { _widthRegistration = layerProperty.GetDataBindingRegistration <float>("Width"); _heightRegistration = layerProperty.GetDataBindingRegistration <float>("Height"); }
public EnumPropertyInputViewModel(LayerProperty <T> layerProperty, IProfileEditorService profileEditorService) : base(layerProperty, profileEditorService) { EnumValues = new BindableCollection <ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(T))); }
public BoolPropertyInputViewModel(LayerProperty <bool> layerProperty, IProfileEditorService profileEditorService) : base(layerProperty, profileEditorService) { _registrations = layerProperty.GetAllDataBindingRegistrations(); }
void LoadLevel(string levelName) { string path = Application.dataPath + "/" + LevelFolder + "/" + levelName; /********Load level data from level document***************/ XmlDocument layerdoc = new XmlDocument(); layerdoc.Load(path + "/leveldef.xml"); int i = 0; foreach (XmlNode singlelayer in layerdoc.SelectNodes("layers/layer")) { string imgpath = path + "/" + singlelayer.SelectSingleNode("imgfile").InnerText + ".png"; GameObject newLayer = Instantiate(LayerPrefab, _transform.position, Quaternion.identity) as GameObject; newLayer.transform.parent = _transform; //load image Texture2D tex = new Texture2D(2, 2); tex.LoadImage(File.ReadAllBytes(imgpath)); //turn image into sprite Rect texRect = new Rect(0, 0, tex.width, tex.height); Sprite texSprite = Sprite.Create(tex, texRect, new Vector2(0.5f, 0.5f), 100); SpriteRenderer spRenderer = newLayer.GetComponent <SpriteRenderer>(); spRenderer.sprite = texSprite; //add collider newLayer.AddComponent <PolygonCollider2D>(); newLayer.collider2D.isTrigger = true; //change name and apply properties string imgName = imgpath.Substring(path.Length + 1, imgpath.Length - path.Length - 1 - 4); newLayer.name = imgName; spRenderer.sortingOrder = i; LayerProperty layerProp = newLayer.GetComponent <LayerProperty>(); //set layer type layerProp.SetType(System.Convert.ToInt32(singlelayer.SelectSingleNode("type").InnerText)); //set layer shape marker if (singlelayer.SelectSingleNode("shapemarker") != null) { layerProp.SetLayerShape(System.Convert.ToInt32(singlelayer.SelectSingleNode("shapemarker").InnerText)); } //set damage factor layerProp.SetDamageFactor(System.Convert.ToSingle(singlelayer.SelectSingleNode("damagefactor").InnerText)); //set speed factor layerProp.SetSpeedFactor(System.Convert.ToSingle(singlelayer.SelectSingleNode("speedfactor").InnerText)); //set fossil fuel possibility float maxPossibility = System.Convert.ToSingle(singlelayer.SelectSingleNode("maxoilpossibility").InnerText); float minPossibility = System.Convert.ToSingle(singlelayer.SelectSingleNode("minoilpossibility").InnerText); layerProp.SetPossibility(Random.Range(minPossibility, maxPossibility)); //set fossil fuel amount float maxAmount = System.Convert.ToSingle(singlelayer.SelectSingleNode("maxoilamount").InnerText); float minAmount = System.Convert.ToSingle(singlelayer.SelectSingleNode("minoilamount").InnerText); layerProp.SetFossilFuelAmount(Random.Range(minAmount, maxAmount)); //set porosity layerProp.SetPorosity(System.Convert.ToSingle(singlelayer.SelectSingleNode("prosity").InnerText)); //set density layerProp.SetDensity(System.Convert.ToSingle(singlelayer.SelectSingleNode("density").InnerText)); i++; } /* * string[] layerFileImg = Directory.GetFiles(path, "*.png"); * foreach (string imgpath in layerFileImg) { * GameObject newLayer = Instantiate(LayerPrefab, _transform.position, Quaternion.identity) as GameObject; * newLayer.transform.parent = _transform; * //load image * Texture2D tex = new Texture2D(2,2); * tex.LoadImage(File.ReadAllBytes(imgpath)); * //turn image into sprite * Rect texRect = new Rect(0,0,tex.width, tex.height); * Sprite texSprite = Sprite.Create(tex, texRect, new Vector2(0.5f, 0.5f), 100); * SpriteRenderer spRenderer = newLayer.GetComponent<SpriteRenderer>(); * spRenderer.sprite = texSprite; * //add collider * newLayer.AddComponent<PolygonCollider2D>(); * newLayer.collider2D.isTrigger = true; * //change name and apply properties * string imgName = imgpath.Substring(path.Length+1, imgpath.Length-path.Length-1-4); * string[] segments = imgName.Split(new char[]{'_'}); * newLayer.name = segments[0]; * spRenderer.sortingOrder = IntParse(segments[0]); * LayerProperty layerProp = newLayer.GetComponent<LayerProperty>(); * layerProp.SetType(segments[1]); * }*/ SendMessage("LoadLevelFinish"); }
public IntPropertyInputViewModel(LayerProperty <int> layerProperty, IProfileEditorService profileEditorService, IModelValidator <IntPropertyInputViewModel> validator) : base(layerProperty, profileEditorService, validator) { _registration = layerProperty.GetDataBindingRegistration <int>("Value"); }
public string HoldLayerName() { LayerProperty layerS = layerScripts [0] as LayerProperty; return(layerS.name); }
public FilePathPropertyDisplayViewModel(LayerProperty <string> layerProperty, IProfileEditorService profileEditorService, IDialogService dialogService) : base(layerProperty, profileEditorService) { _dialogService = dialogService; }
public FloatPropertyInputViewModel(LayerProperty <float> layerProperty, IProfileEditorService profileEditorService, IModelValidator <FloatPropertyInputViewModel> validator) : base(layerProperty, profileEditorService, validator) { _registration = layerProperty.GetDataBindingRegistration(value => value); }
public Keyframe(Layer layer, LayerProperty <T> propertyBase) : base(layer, propertyBase) { }
void OnTriggerEnter2D(Collider2D other) { switch (other.tag) { case "layer": LayerProperty layerProp = other.GetComponent <LayerProperty>(); speedFactor = layerProp.GetSpeedFactor(); damageFactor = layerProp.GetDamageFactor(); CameraShaking.instance.SetShakingPower((layerProp.GetDensity() / 70f) * 0.05f + 0.07f); layerIndicate.renderer.material.color = DataManager.instance.GetColorOfType(layerProp.type); break; case "PlanMarker": Marker markerCtrl = other.GetComponent <Marker>(); float fossilfuel = markerCtrl.GetFossilFuelHere(); GameObject feedback = Instantiate(feedbackText, transform.position + Vector3.up, Quaternion.identity) as GameObject; TextFeedback feedbackScript = feedback.GetComponent <TextFeedback>(); if (fossilfuel > 0) { if (fossilfuel > DataManager.instance.GetAvgScore()) { feedbackScript.SetText(2, (fossilfuel / DataManager.instance.GetTotalScore()) * 7000000); } else { feedbackScript.SetText(1, (fossilfuel / DataManager.instance.GetTotalScore()) * 7000000); } DataManager.instance.AddToScore(fossilfuel); SoundFXCtrl.instance.PlaySound(7, 1); } else { feedbackScript.SetText(0, 0); } if (markerCtrl.HasBeenSampled()) { float fossilPossibility = markerCtrl.GetAvgPossibilityHere(); if (fossilPossibility < 30) { if (fossilfuel > 0) { PlanPathManager.instance.PauseDrill(0); } else { PlanPathManager.instance.PauseDrill(1); } } else if (fossilPossibility < 70) { if (fossilfuel > 0) { PlanPathManager.instance.PauseDrill(2); } else { PlanPathManager.instance.PauseDrill(3); } } else { if (fossilfuel > 0) { PlanPathManager.instance.PauseDrill(4); } else { PlanPathManager.instance.PauseDrill(5); } } } else { if (DataManager.instance.GetLayerShape(markerCtrl.HoldLayerName()) == LayerShape.Normal) { if (fossilfuel > 0) { PlanPathManager.instance.PauseDrill(9); } else { PlanPathManager.instance.PauseDrill(8); } } else { if (fossilfuel > 0) { PlanPathManager.instance.PauseDrill(6); } else { PlanPathManager.instance.PauseDrill(7); } } } break; } }