private void SeedSelectedEvent(SeedBox _seedBox) { _selectedBox = _seedBox; if (_seedBox.IsFull) { InputController.Instance.DragSeedBegin(_seedBox); return; } else { _seedBox.PlaceSeed(SeedController.Instance.GetSeed(0)); _selectedBox = null; } return; if (_selectedBox != null && _seedBox != null && _selectedBox != _seedBox) { if (_selectedBox.IsFull && _seedBox.IsFull) { // Merge seeds attempt SeedController.Instance.MergeSeeds(_selectedBox._currentSeed, _seedBox._currentSeed, (s) => { _seedBox.PlaceSeed(s); _selectedBox.RemoveSeed(); _selectedBox = null; }, () => { _selectedBox = null; }); } else if (!_seedBox.IsFull && _selectedBox.IsFull) { // Move seed from box _seedBox.PlaceSeed(_selectedBox._currentSeed); _selectedBox.RemoveSeed(); } else if (_seedBox.IsFull && !_selectedBox.IsFull) { _selectedBox = _seedBox; } else { _selectedBox = null; } } else { // Selecting new box if (_seedBox._currentSeed != null) { _selectedBox = _seedBox; } else { _seedBox.PlaceSeed(SeedController.Instance.GetSeed(0)); _selectedBox = null; } } SaveSeeds(); }
public override void OnInspectorGUI() { SeedBox data = (SeedBox)target; base.OnInspectorGUI(); data._seedIcon = (Image)EditorGUILayout.ObjectField("Icon", data._seedIcon, typeof(Image), true); data._seedText = (Text)EditorGUILayout.ObjectField("Text", data._seedText, typeof(Text), true); data._currentSeed = (Seed)EditorGUILayout.ObjectField("Seed", data._currentSeed, typeof(Seed), true); data._highlight = (GameObject)EditorGUILayout.ObjectField("HighLight", data._highlight, typeof(GameObject), true); }
private void PlantCallBack(PlantBox box, SeedBox seedBox) { if (box == null || seedBox == null) { return; } if (box.IsFull || !seedBox.IsFull) { return; } box.PlantSeed(seedBox._currentSeed); seedBox.RemoveSeed(); SaveSeeds(); }
public void SelectSeedBox(SeedBox seedBox) { if (_currentlySelectedSeed != null && _lastSelectedSeedBox != null) { SeedController.Instance.MergeSeeds(seedBox._currentSeed, _currentlySelectedSeed, (s) => { seedBox.PlaceSeed(s); _lastSelectedSeedBox.RemoveSeed(); _lastSelectedSeedBox = null; _currentlySelectedSeed = null; }, () => { _currentlySelectedSeed = null; _lastSelectedSeedBox = null; }); } else { _lastSelectedSeedBox = seedBox; _currentlySelectedSeed = seedBox._currentSeed; } }
private void SeedDroppedEvent(SeedBox _seedBox, SeedBox _selectBox) { if (_selectBox == null || _seedBox == null) { return; } if (_selectBox.IsFull && _seedBox.IsFull) { // Merge seeds attempt SeedController.Instance.MergeSeeds(_selectedBox._currentSeed, _seedBox._currentSeed, (s) => { _seedBox.PlaceSeed(s); _selectBox.RemoveSeed(); }, () => { }); } else if (!_seedBox.IsFull && _selectBox.IsFull) { // Move seed from box _seedBox.PlaceSeed(_selectedBox._currentSeed); _selectedBox.RemoveSeed(); } SaveSeeds(); }
private void PlantBoxSelected(PlantBox _box) { if (_box.IsFull && _box.fullyGrown && !_box._hasReturnedSeed) { // Try Harvest if (_seedBoxContainer.HasEmptySpace) { Seed _seed = _box.Harvest(); if (_seed != null) { _seedBoxContainer.AddToSlot(_seed); SaveSeeds(); } } else if (_box.IsFull) { if (PlantInteractorView.Instance != null) { PlantInteractorView.Instance.OpenPanel(_box); } } } else if (!_box.IsFull && _selectedBox != null && _selectedBox.IsFull) { _box.PlantSeed(_selectedBox._currentSeed); _selectedBox.RemoveSeed(); } else if (_box.IsFull) { if (PlantInteractorView.Instance != null) { PlantInteractorView.Instance.OpenPanel(_box); } } _selectedBox = null; SaveSeeds(); }
public SeedBoxGump(Mobile owner, SeedBox box, int PlantId) : base(10, 10) { owner.CloseGump(typeof(SeedBoxGump)); int gumpX = 0; int gumpY = 0; //bool initialState = false; m_Owner = owner; m_box = box; m_id = PlantId; Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); gumpX = 0; gumpY = 0; AddBackground(24, 24, 644, 445, 9200); AddBackground(40, 62, 204, 392, 83); AddImageTiled(48, 71, 190, 354, 1416); AddAlphaRegion(48, 71, 190, 374); AddBackground(255, 62, 394, 392, 83); AddImageTiled(263, 71, 380, 354, 1416); AddAlphaRegion(263, 71, 380, 374); AddLabel(103, 35, 1152, "Seed Types"); AddLabel(423, 36, 1152, "Seed Colors"); AddImage(290, 81, 3203); AddImage(82, 39, 216); AddImage(184, 39, 216); AddImage(394, 39, 216); AddImage(510, 39, 216); gumpX = 55; //20 gumpY = 77; //30 for (int i = 0; i < 18; i++) { int count = 0; for (int j = 0; j < 21; j++) { count += m_box.m_counts[i, j]; } if (count > 0) { if (i == m_id) { AddButton(gumpX, gumpY, 4006, 4007, i + 1, GumpButtonType.Reply, 0); } else { AddButton(gumpX, gumpY, 4005, 4007, i + 1, GumpButtonType.Reply, 0); } } this.AddLabel(gumpX + 30, gumpY, (count > 0?1152:808), m_Strings[i]); gumpY += 20; } int but1 = 270; int lab1 = but1 + 40; int but2 = but1 + 170; int lab2 = but2 + 40; gumpY = 77; #region Plain //*****PLAIN***** if (m_box.m_counts[m_id, 18] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 36, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 355, m_box.m_counts[m_id, 18].ToString() + " Plain"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Plain"); } gumpY += 40; #endregion #region Rares //*****MAGENTA**** if (m_box.m_counts[m_id, 14] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 32, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 316, m_box.m_counts[m_id, 14].ToString() + " Rare Magenta"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Rare Magenta"); } gumpY += 20; //*****PINK***** if (m_box.m_counts[m_id, 15] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 33, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 30, m_box.m_counts[m_id, 15].ToString() + " Rare Pink"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Rare Pink"); } gumpY += 20; //*****AQUA**** if (m_box.m_counts[m_id, 17] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 35, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 86, m_box.m_counts[m_id, 17].ToString() + " Rare Aqua"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Rare Aqua"); } gumpY += 20; //*****FIRE RED***** if (m_box.m_counts[m_id, 16] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 34, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 43, m_box.m_counts[m_id, 16].ToString() + " Rare Fire Red"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Rare Fire Red"); } gumpY += 40; #endregion #region StandardColors //*****RED***** if (m_box.m_counts[m_id, 2] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 26, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 36, m_box.m_counts[m_id, 2].ToString() + " Red"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Red"); } //*****BRIGHT RED***** if (m_box.m_counts[m_id, 3] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 27, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 38, m_box.m_counts[m_id, 3].ToString() + " Bright Red"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Bright Red"); } gumpY += 20; //*****ORANGE**** if (m_box.m_counts[m_id, 10] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 28, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 41, m_box.m_counts[m_id, 10].ToString() + " Orange"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Orange"); } //*****BRIGHT ORANGE***** if (m_box.m_counts[m_id, 11] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 30, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 42, m_box.m_counts[m_id, 11].ToString() + " Bright Orange"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Bright Orange"); } gumpY += 20; //*****YELLOW**** if (m_box.m_counts[m_id, 8] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 20, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 251, m_box.m_counts[m_id, 8].ToString() + " Yellow"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Yellow"); } //*****BRIGHT YELLOW***** if (m_box.m_counts[m_id, 9] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 23, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 153, m_box.m_counts[m_id, 9].ToString() + " Bright Yellow"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Bright Yellow"); } gumpY += 20; //*****GREEN**** if (m_box.m_counts[m_id, 4] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 21, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 61, m_box.m_counts[m_id, 4].ToString() + " Green"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Green"); } //*****BRIGHT GREEN***** if (m_box.m_counts[m_id, 5] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 24, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 163, m_box.m_counts[m_id, 5].ToString() + " Bright Green"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Bright Green"); } gumpY += 20; //*****BLUE**** if (m_box.m_counts[m_id, 6] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 22, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 102, m_box.m_counts[m_id, 6].ToString() + " Blue"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Blue"); } //*****BRIGHT BLUE***** if (m_box.m_counts[m_id, 7] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 25, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 104, m_box.m_counts[m_id, 7].ToString() + " Bright Blue"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Bright Blue"); } gumpY += 20; //*****PURPLE**** if (m_box.m_counts[m_id, 12] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 29, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 17, m_box.m_counts[m_id, 12].ToString() + " Purple"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Purple"); } //*****BRIGHT PURPLE***** if (m_box.m_counts[m_id, 13] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 31, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 19, m_box.m_counts[m_id, 13].ToString() + " Bright Purple"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Bright Purple"); } gumpY += 40; #endregion #region Mutations //*****BLACK**** if (m_box.m_counts[m_id, 0] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 38, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 0, m_box.m_counts[m_id, 0].ToString() + " Black Mutation"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Black Mutation"); } //*****WHITE***** if (m_box.m_counts[m_id, 1] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 19, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 2100, m_box.m_counts[m_id, 1].ToString() + " White Mutation"); } else { AddLabel(lab2, gumpY + 3, 808, "0 White Mutation"); } gumpY += 20; //*****Solen***** if (m_box.m_counts[m_id, 19] > 0) { AddButton(but1, gumpY, 0xFA5, 0xFA6, 37, GumpButtonType.Reply, 0); AddLabel(lab1, gumpY + 3, 61, m_box.m_counts[m_id, 19].ToString() + " Solen"); } else { AddLabel(lab1, gumpY + 3, 808, "0 Solen"); } //*****NONE***** //PlantHue.None == mutant (like Hedges) if (m_box.m_counts[m_id, 20] > 0) { AddButton(but2, gumpY, 0xFA5, 0xFA6, 39, GumpButtonType.Reply, 0); AddLabel(lab2, gumpY + 3, 61, m_box.m_counts[m_id, 20].ToString() + " Other Mutation"); } else { AddLabel(lab2, gumpY + 3, 808, "0 Other Mutation"); } gumpY += 20; AddLabel(lab2, gumpY + 3, 2100, m_box.SeedCount().ToString() + " Seeds Held"); gumpY += 40; #endregion //plant name AddLabel(but1 + 20, 77, 1152, m_Strings[m_id]); //plant picture AddItem(lab1, 117, m_ItemIds[m_id]); }
public SeedBoxGump(Mobile owner, SeedBox box) : this(owner, box, 0) { }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { if (_eventSystem.IsPointerOverGameObject()) { } else { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 10000f)) { Debug.Log("Clicked on" + hit.transform.name); PlantBox box = hit.transform.GetComponent <PlantBox>(); if (box != null && box.OnBoxSelect != null) { StartCoroutine(WaitAndTrigger(() => { box.OnBoxSelect?.Invoke(box); })); } else if (hit.transform.gameObject == _chestObject) { _chestObject.SetActive(false); if (ItemParticlesAnimator.Instance != null) { ItemParticlesAnimator.Instance.NewGenericRewardAnimation(CurrencyManager.Instance.MainCurrency, ItemParticlesAnimator.Instance.DefaultAnimation, 100, Input.mousePosition, IncrementalController.Instance.CurrencyDestination.transform.position); StartCoroutine(SlowlyAddToCurrency()); } } } } } if (Input.GetMouseButton(0) && _dragSeedBox != null) { dragImage.rectTransform.position = Input.mousePosition; } if (Input.GetMouseButtonUp(0)) { if (_nextSeedBox != null && _dragSeedBox != null) { _nextSeedBox.DropCall?.Invoke(_nextSeedBox, _dragSeedBox); } else { if (_eventSystem.IsPointerOverGameObject()) { } else if (_dragSeedBox != null) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 10000f)) { PlantBox box = hit.transform.GetComponent <PlantBox>(); if (box != null) { GameObject g = Instantiate(_plantParticle, this.transform); g.transform.position = box.transform.position + new Vector3(0, 0.1f, 0); Destroy(g, 1f); box.PlantCallBack?.Invoke(box, _dragSeedBox); StartCoroutine(WaitAndTrigger(() => { if (ItemParticlesAnimator.Instance != null) { ItemParticlesAnimator.Instance.NewGenericRewardAnimation(CurrencyManager.Instance.MainCurrency, ItemParticlesAnimator.Instance.DefaultAnimation, 100, new Vector3(Screen.width / 2, Screen.height / 2, 0) /*dragImage.gameObject.transform*/, IncrementalController.Instance.CurrencyDestination.transform.position); StartCoroutine(SlowlyAddToCurrency()); } })); } } } } dragImage.gameObject.SetActive(false); _dragSeedBox = null; _nextSeedBox = null; } if (Input.GetKeyDown(KeyCode.Space)) { _chestObject.SetActive(true); } if (Input.GetKeyDown(KeyCode.LeftShift)) { if (NewAreaUnlocked.Instance != null) { NewAreaUnlocked.Instance.Show(); } } }
public void DragSeedBegin(SeedBox _seedBox) { _dragSeedBox = _seedBox; dragImage.sprite = _seedBox._currentSeed._icon; dragImage.gameObject.SetActive(true); }
private void PlantCallBack(PlantBox box, SeedBox seedBox) { PlantCall?.Invoke(box, seedBox); }
public void ClickSeedBox(SeedBox _box) { OnSeedSelected?.Invoke(_box); }
private void DropSeedBox(SeedBox targetBox, SeedBox selectedBox) { OnSeedDropped?.Invoke(targetBox, selectedBox); }
public SeedTask(SeedBox seedBox, TaskTypes type) { this.seedBox = seedBox; seedType = type; }