void doAction(string item) { Debug.Log("doAction: " + item); if (type.ToString() == "food") { runFood(item); } else if (type.ToString() == "equipment") { Debug.Log("can't use equipment yet"); } }
private ListViewItem RetrieveVirtualItem(int index) { if (this.itemCache != null && index >= this.cacheOffset && index < this.cacheOffset + (int)this.itemCache.Length) { return(this.itemCache[index - this.cacheOffset]); } if (this.mappedNodes[index] is ChangeListTree.RootNode) { GameData.Item item = (this.mappedNodes[index] as ChangeListTree.RootNode).Item; ListViewItem listViewItem = new ListViewItem(item.Name); ListViewItem.ListViewSubItemCollection subItems = listViewItem.SubItems; itemType _itemType = item.type; subItems.Add(_itemType.ToString(), listViewItem.ForeColor, listViewItem.BackColor, listViewItem.Font); listViewItem.SubItems.Add(""); listViewItem.Checked = this.mappedNodes[index].Checked; listViewItem.ForeColor = StateColours.GetStateColor(item.getState()); listViewItem.Tag = this.mappedNodes[index]; return(listViewItem); } if (!(this.mappedNodes[index] is ChangeListTree.ChangeData)) { return(null); } ChangeListTree.ChangeData changeDatum = this.mappedNodes[index] as ChangeListTree.ChangeData; ListViewItem @checked = new ListViewItem(changeDatum.Text ?? changeDatum.Key); ListViewItem.ListViewSubItemCollection listViewSubItemCollections = @checked.SubItems; ChangeListTree.ChangeType type = changeDatum.Type; listViewSubItemCollections.Add(type.ToString(), @checked.ForeColor, @checked.BackColor, @checked.Font); @checked.SubItems.Add(changeDatum.ToString(), @checked.ForeColor, @checked.BackColor, @checked.Font); @checked.Checked = changeDatum.Checked; @checked.ForeColor = changeDatum.Colour; @checked.Tag = changeDatum; return(@checked); }
public void Collect() { Debug.Log(ItemType.ToString() + ", collected!"); switch (ItemType) { case itemType.Potion: ////Gain Health break; case itemType.Special: ////Special Attack break; case itemType.Attack: ////Special Attack Level Up break; case itemType.Page: ////Increase Pages break; case itemType.Coin: ////Increase Pages break; default: break; } }
private void addListItem(string key, ToDo.Item data) { string str = (data.item == null ? key : data.item.Name); itemType _itemType = (data.item == null ? itemType.NULL_ITEM : data.item.type); ListViewItem listViewItem = this.listView.Items.Add(key, str, 0); listViewItem.SubItems.Add(_itemType.ToString()); listViewItem.SubItems.Add(data.State.ToString()); listViewItem.SubItems.Add(data.Priority.ToString()); listViewItem.SubItems.Add(this.assignList[data.Assigned]); if (data.Description != null) { listViewItem.SubItems.Add(data.Description.Replace("\n", " ")); } listViewItem.Tag = data; }
// Use this for initialization public void SetItem(Sprite smth, itemType i, DressManager dm, bool equipped) { Image img = GetComponent <Image>(); string key = i.ToString().Substring(0, 2); if (equipped) { Debug.Log("set color!"); if (dm.fm.XtraStuff.ContainsKey(key) && dm.fm.XtraStuff[key] != null) { img.color = dm.fm.XtraStuff[key].color; } } else { img.color = Color.white; } Helper(img, smth, i, dm, equipped); }
public void SpawnObject() { Debug.Log("Spawning object " + itemDrop.ToString()); if (itemDrop != itemType.None) { // we actually spawning something here ItemType[] items = pc.gameManager.GetComponent <InventoryManager>().ItemPool; List <ItemType> filteredList = new List <ItemType>(); foreach (ItemType item in items) { if (item.Type == itemDrop) { filteredList.Add(item); } } ItemType chosenType = filteredList[UnityEngine.Random.Range(0, filteredList.Count)]; GameObject newSpawn = Instantiate(chosenType.Prefab); newSpawn.transform.position = new Vector3(transform.position.x, transform.position.y, -1f); newSpawn.GetComponent <InteractableObject>().typeOfItem = chosenType; Destroy(transform.GetComponent <BoxCollider2D>()); } }
public UndoInfo faceSet(Sprite newThang, itemType it) { //key is the first 2 chars. if 2nd, first 2 chars+"2" if (newThang != null) { Debug.Log("set face with " + newThang.name + " at " + it); } UndoInfo hm; hm.set = null; hm.set2 = null; hm.before = null; hm.beforeC = Color.white; hm.beforeC2 = Color.white; string key = ""; if (newThang != null && it != itemType.BMlm) { key = newThang.name.Substring(0, 2); } switch (it) { case itemType.iris: hm.set = leftE[1]; hm.set2 = rightE[1]; hm.before = hm.set.sprite; break; case itemType.w_hites: hm.set = leftE[0]; hm.set2 = rightE[0]; hm.before = hm.set.sprite; break; case itemType.eyelid: hm.set = skin[5]; hm.set2 = skin[7]; break; case itemType.se: if (!XtraStuff.ContainsKey(key)) { hm.set = newImgAt(key, new Vector2(-3f, 7.783465f), leftE[2], null, 1); hm.set2 = newImgAt(key, new Vector2(-3f, 7.783465f), rightE[2], null, 1); } else { hm.set = XtraStuff[key]; hm.set2 = XtraStuff[key + "2"]; hm.before = hm.set.sprite; } break; case itemType.Se: Debug.Log("add Se"); if (!XtraStuff.ContainsKey(key)) { hm.set = newImgAt(key, new Vector2(9.5f, 0.5f), leftE[2], null, 1); hm.set2 = newImgAt(key, new Vector2(-28.2f, 0.5f), rightE[2], null, 1); } else { hm.set = XtraStuff[key]; hm.set2 = XtraStuff[key + "2"]; hm.before = hm.set.sprite; } break; case itemType.xe: if (!XtraStuff.ContainsKey(key)) { hm.set = newImgAt(key, new Vector2(-4.5f, -5.4f), leftE[2], leftE[1].transform, 1); hm.set2 = newImgAt(key, new Vector2(-4.5f, -5.4f), rightE[2], rightE[1].transform, 1); } else { hm.set = XtraStuff[key]; hm.set2 = XtraStuff[key + "2"]; hm.before = hm.set.sprite; } Material addY = Resources.Load <Material>("Additive"); hm.set.material = addY; hm.set2.material = addY; break; case itemType.BOW: int indexbo; if (XtraStuff.ContainsKey("ch") && XtraStuff["ch"].sprite.name == "chsf") { indexbo = XtraStuff["ch"].transform.GetSiblingIndex(); } else { indexbo = clothes.transform.parent.childCount; } switch (newThang.name) { case "BOW": setHm(new Vector2(10.378f, 453f), clothes, null, indexbo, key, ref hm); break; default: setHm(new Vector2(0f, 0f), clothes, null, indexbo, key, ref hm); break; } break; case itemType.chneckwear: int index = 0; if (newThang.name == "chsf") { index = clothes.transform.parent.childCount; } else if (newThang.name == "choker") { index = -1; } else if (XtraStuff.ContainsKey("BO")) { index = XtraStuff["BO"].transform.GetSiblingIndex(); } switch (newThang.name) { case "choker": setHm(new Vector2(10.37823f, 531f), clothes, null, index, key, ref hm); break; case "chokerbow": setHm(new Vector2(10.37823f, 12.9f), clothes, null, index, key, ref hm); break; case "chsf": setHm(new Vector2(-26.94f, 3.26f), clothes, null, index, key, ref hm); break; } break; case itemType.glasses: setHm(new Vector2(-7.5f, 72.5f), skin[6], null, 0, key, ref hm); break; case itemType.freckles: setHm(new Vector2(0f, -81.5f), skin[6], null, skin[0].transform.GetSiblingIndex() + 1, key, ref hm); break; case itemType.starfreckles: setHm(new Vector2(0f, -102f), skin[6], null, skin[6].rectTransform.GetSiblingIndex(), key, ref hm); break; case itemType.lippiercing: setHm(new Vector2(0f, 32.9f), skin[6], lips.rectTransform, 4, key, ref hm); break; case itemType.sl1: setHm(new Vector2(0.55f, 11.1f), skin[6], lips.rectTransform, 0, key, ref hm); hm.set.material = Resources.Load <Material>("Additive"); break; case itemType.sx_tears: setHm(new Vector2(29.7f, -39.86f), rightE[2], null, rightE[0].transform.childCount, key, ref hm); break; case itemType.bubble: setHm(new Vector2(-6.151662f, -271.2f), skin[6], null, 0, key, ref hm); break; case itemType.eear: int index2; if (XtraStuff.ContainsKey("ha")) { index2 = XtraStuff["ha"].transform.GetSiblingIndex(); } else if (XtraStuff.ContainsKey("fl")) { index2 = XtraStuff["fl"].transform.GetSiblingIndex(); } else if (XtraStuff.ContainsKey("he")) { index2 = XtraStuff["he"].transform.GetSiblingIndex(); } else { index2 = 0; } setHmTwice(new Vector2(-328.1f, 570.4f), new Vector2(329.3f, 570.4f), skin[6], null, index2, key, ref hm); break; case itemType.hesidehorn: int index3; if (XtraStuff.ContainsKey("ha")) { index3 = XtraStuff["ha"].transform.GetSiblingIndex(); } else if (XtraStuff.ContainsKey("fl")) { index3 = XtraStuff["fl"].transform.GetSiblingIndex(); } else { index3 = 0; } setHmTwice(new Vector2(-328.1f, 566.2f), new Vector2(329.3012f, 566.2f), skin[6], null, index3, key, ref hm); break; case itemType.EPatch: setHm(new Vector2(-225.1f, 52.7f), rightE[2], null, 0, key, ref hm); break; case itemType.hdphones: setHmTwice(new Vector2(-238.808f, 468.9f), new Vector2(231f, 468.9f), skin[6], null, bangs.transform.GetSiblingIndex(), key, ref hm); break; case itemType.ctetopband: int indexCT; if (XtraStuff.ContainsKey("un")) { indexCT = XtraStuff["un"].transform.GetSiblingIndex(); } else { indexCT = skin[6].transform.parent.childCount; } switch (newThang.name) { case "ctcr": setHmTwice(new Vector2(-101f, 614.2f), new Vector2(101f, 614.2f), skin[6], null, indexCT, key, ref hm); break; case "ctband": setHmTwice(new Vector2(-201f, 600.2f), new Vector2(201f, 600.2f), skin[6], null, indexCT, key, ref hm); break; } break; case itemType.msk: int index5; if (XtraStuff.ContainsKey("hd")) { index5 = XtraStuff["hd"].transform.GetSiblingIndex(); } else { index5 = bangs.transform.GetSiblingIndex(); } setHmTwice(new Vector2(-173.0009f, -192.2f), new Vector2(162.4f, -192.2f), skin[6], null, index5, key, ref hm); break; case itemType.scar: setHm(new Vector2(-7.828147f, 16.29871f), rightE[2], null, 0, key, ref hm); break; case itemType.unicorn: setHm(new Vector2(44.5f, 607.314f), skin[6], null, 0, key, ref hm); break; case itemType.b0odnos: setHm(new Vector2(24.1f, -30.4f), skin[6], skin[0].rectTransform, skin[6].transform.parent.childCount, key, ref hm); break; case itemType.bood: setHm(new Vector2(34f, -143.3f), skin[6], null, 0, key, ref hm); break; case itemType.hwrstrand: setHm(new Vector2(15f, 629.59f), skin[6], null, 1, key, ref hm); break; case itemType.harts: setHm(new Vector2(6f, 524.4f), skin[6], null, 0, key, ref hm); break; case itemType.overalls: setHm(Vector2.zero, clothes, null, 1, key, ref hm); break; case itemType.hrclip: setHm(new Vector2(354.7f, 263f), skin[6], null, bangs.transform.GetSiblingIndex() + 1, key, ref hm); break; case itemType.nosepiercing: setHm(new Vector2(-50.9f, -51f), skin[6], skin[0].rectTransform, skin[6].transform.parent.childCount, key, ref hm); break; case itemType.JBandage: setHm(new Vector2(-199.7f, -274.8f), skin[6], null, bangs.transform.GetSiblingIndex(), key, ref hm); break; case itemType.bDaid: setHmTwice(new Vector2(-67.8f, 24.8f), new Vector2(67.8f, 24.8f), skin[6], skin[0].rectTransform, 0, key, ref hm); break; case itemType.FGliter: setHmTwice(new Vector2(-122f, 0f), new Vector2(122f, 0f), skin[6], null, 2, key, ref hm); Material add = Resources.Load <Material>("Additive"); hm.set.material = add; hm.set2.material = add; break; case itemType.bronzer: setHmTwice(new Vector2(-237f, 108.1f), new Vector2(237f, 108.1f), skin[6], null, 2, key, ref hm); break; case itemType.UEye: setHmTwice(new Vector2(-190f, 24.4f), new Vector2(190f, 24.4f), skin[6], null, 2, key, ref hm); break; /* * overall * scarf * cutetopband * unicorn * tie * * hairclip * nose ring * bandage * bandaid * * faceglitter * undereye * bronzer * happy eye/squint * * petal * backgrounds * */ case itemType.flower: int index4; if (XtraStuff.ContainsKey("ha")) { index4 = XtraStuff["ha"].transform.GetSiblingIndex(); } else if (XtraStuff.ContainsKey("ct")) { index4 = XtraStuff["ct"].transform.GetSiblingIndex() + 1; } else { index4 = 0; } setHm(new Vector2(0f, 422.9f), skin[6], null, index4, key, ref hm); break; case itemType.e_ye: hm.set = skin[2]; hm.set2 = skin[3]; hm.before = hm.set.sprite; break; case itemType.l_p: hm.set = lips; hm.before = hm.set.sprite; break; case itemType.n_se: hm.set = skin[0]; hm.before = hm.set.sprite; break; case itemType.t_clothes: hm.set = clothes; clothes.gameObject.SetActive(true); XtraStuff[key] = clothes; hm.before = hm.set.sprite; break; case itemType.bg: hm.set = bg; hm.beforeC = hm.set.color; hm.before = hm.set.sprite; hm.beforeC2 = Camera.main.backgroundColor; if (newThang == null) { hm.set.sprite = null; hm.set.color = Color.clear; } else { hm.beforeC = hm.set.color; if (hm.before == null || (hm.before != null && hm.before.name != newThang.name)) { hm.set.color = Color.white; } } break; case itemType.ebrow: hm.set = leftE[2]; hm.set2 = rightE[2]; hm.before = hm.set.sprite; break; case itemType.bh_air: hm.set = hair; hm.before = hm.set.sprite; Vector2 size = hair.rectTransform.sizeDelta; hm.beforeC2 = new Color(size.x / 1500, size.y / 2500, 0, 0); break; case itemType.b_ngs: hm.set = bangs; hm.before = hm.set.sprite; if (newThang.name == "b_92") { bangs.rectTransform.anchoredPosition = new Vector2(bangs.rectTransform.anchoredPosition.x, 625.8f); } else { bangs.rectTransform.anchoredPosition = new Vector2(bangs.rectTransform.anchoredPosition.x, 503); } break; case itemType.skin: hm.set = skin[1]; hm.before = hm.set.sprite; hm.beforeC2 = lips.color; break; case itemType.blush: hm.set = skin[6]; hm.set.gameObject.SetActive(true); XtraStuff[key] = skin[6]; hm.before = hm.set.sprite; break; case itemType.Particle_petal: case itemType.pArticle_sparkle: case itemType.particle_snow: hm.before = newThang; XtraStuff[key] = null; break; case itemType.wdEluxeScript: int indexWd = 0; if (XtraStuff.ContainsKey("wf")) { indexWd = XtraStuff["wf"].transform.GetSiblingIndex(); } setHm(Vector2.zero, bg, bg.transform.parent, indexWd, "wd", ref hm); if (hm.set.gameObject.GetComponent <WaterScript>() == null) { hm.set.gameObject.AddComponent <WaterScript>(); } hm.set.sprite = null; hm.set.gameObject.name = "wd"; break; case itemType.wfFallScript: setHm(Vector2.zero, bg, bg.transform.parent, 0, "wf", ref hm); WaterfallScript wf = hm.set.gameObject.GetComponent <WaterfallScript>(); if (wf == null) { hm.set.gameObject.AddComponent <WaterfallScript>(); } else { hm.beforeC = wf.LightColor; } hm.set.sprite = null; hm.set.gameObject.name = "wf"; break; case itemType.GXlitch: if (!XtraStuff.ContainsKey("GX")) { Glitch g = Camera.main.gameObject.GetComponent <Glitch>(); g.enabled = true; g.colorDrift = 0.25f; XtraStuff["GX"] = null; } hm.before = newThang; break; case itemType.CXolor: case itemType.BMlm: case itemType.BNry: case itemType.RPamp: case itemType.FRGradient: string FXkey = it.ToString().Substring(0, 2); XtraStuff[FXkey] = null; break; } if (hm.set != null) { if (hm.set != bg && it != itemType.wfFallScript) { hm.beforeC = hm.set.color; } if (newThang != null) { hm.set.sprite = newThang; setNative(hm.set, it); if (hm.set2 != null) { hm.set2.sprite = newThang; hm.beforeC2 = hm.set2.color; setNative(hm.set2, it); } } } return(hm); }
public String getTypeName() { return(type.ToString()); }
void SetUpButton(Button b, Sprite smth, itemType i, DressManager dm) { b.onClick.RemoveAllListeners(); b.onClick.AddListener(() => { ColorPicker cpa = dm.cpa; UndoInfo fs = dm.fm.faceSet(smth, i); if (isSpecialFX(i)) { SpecialFX(i, dm, fs); return; } HashSet <itemType> slidersOnly = new HashSet <itemType>() { itemType.GXlitch, itemType.n_se, itemType.eyelid, itemType.CHIN, itemType.BY_ODY, itemType.HD }; if (slidersOnly.Contains(i)) { handleSlidersOnly(cpa, dm, fs, i); } else { if (fs.set != null) { if (i == itemType.w_hites || i == itemType.hesidehorn || i == itemType.eear) { handleSeparateColors(cpa, fs, dm.x); } else if (i == itemType.bg) { if (smth != null && smth.name[2] == 'p') { handleBackground(cpa, fs, dm.x); } else if (smth != null && (fs.before == null || fs.before.name != fs.set.sprite.name)) { Camera.main.backgroundColor = Color.black; } cpa.Color = Camera.main.backgroundColor; cpa.Reset(); } else { HashSet <itemType> transformThese = new HashSet <itemType>() { itemType.bh_air, itemType.b_ngs, itemType.e_ye, itemType.iris, itemType.l_p, itemType.ebrow }; if (transformThese.Contains(i)) { handleExclusive(cpa, dm.x, dm.fm, i, fs); } cpa.Color = fs.set.color; cpa.Reset(); } } else { if (i.ToString().ToLower().Substring(0, 2) == "pa") { handleParticle(cpa, smth.name, dm); } } cpa.gameObject.SetActive(true); } dm.colorPick(fs, i, transform.GetChild(0).gameObject); }); }
void SpecialFX(itemType i, DressManager dm, UndoInfo fs) { int l = PlayerPrefs.GetInt("Lang"); ColorPicker cpa = dm.cpa; string key = i.ToString().Substring(0, 2); switch (i) { case itemType.BNry: Binary b = Camera.main.gameObject.GetComponent <Binary>(); if (!isEquipped()) { dm.x.onClick.AddListener(() => { dm.fm.Remove("BN"); }); } else { Color c0 = b.color0, c1 = b.color1; float alpha = b.Opacity; dm.x.onClick.AddListener(() => { b.color0 = c0; b.color1 = c1; b.Opacity = alpha; b.updateColor(); }); } cpa.Color = b.color1; cpa.Reset(); Iris lr3 = cpa.getLeftRight(); TurnCanvas(lr3.transform, true); string light, dark; switch (l) { case 1: //chinese light = "光"; dark = "黑暗"; break; case 2: //ja light = "光"; dark = "闇"; break; case 3: //rus light = "легкий"; dark = "темно"; break; case 4: light = "ligero"; dark = "oscuro"; break; case 5: //thai light = "สีอ่อน"; dark = "สีเข้ม"; break; case 6: light = "lumière"; dark = "foncé"; break; default: //english light = "light"; dark = "dark"; break; } lr3.fillButtons(light, dark, () => { b.color1 = cpa.Color; b.updateColor(); }, () => { b.color0 = cpa.Color; b.updateColor(); } ); Slider s = getOpacitySlider(cpa.transform); s.value = b.Opacity; s.onValueChanged.AddListener((float val) => { b.Opacity = val; b.updateColor(); }); dm.x.onClick.AddListener(() => { s.gameObject.SetActive(false); lr3.gameObject.SetActive(false); TurnCanvas(lr3.transform, false); }); b.enabled = true; lr3.setListeners(); break; case itemType.BMlm: Bloom bl = Camera.main.gameObject.GetComponent <Bloom>(); Slider[] t = getSliders(cpa); t[0].onValueChanged.RemoveAllListeners(); t[1].onValueChanged.RemoveAllListeners(); if (!isEquipped()) { dm.x.onClick.AddListener(() => { dm.fm.Remove("BM"); }); } else { float intensity = bl.intensity; float radius = bl.radius; dm.x.onClick.AddListener(() => { bl.intensity = intensity; bl.radius = radius; bl.UpdateParam(); }); } float ratio = 0.3f; float ratio2 = 6f; // 20- 48 Image oneI = t[0].transform.GetChild(1).GetComponent <Image>(); Sprite before = oneI.sprite; oneI.sprite = Resources.Load <Sprite>("random"); oneI.rectTransform.sizeDelta = Vector2.one * 64; t[0].value = (bl.radius - 1) / ratio2; t[1].value = bl.intensity / ratio; dm.x.onClick.AddListener(() => { t[1].transform.parent.gameObject.SetActive(false); oneI.sprite = before; oneI.rectTransform.sizeDelta = Vector2.one * 80.99f; }); t[0].onValueChanged.AddListener((float val) => { val = val / 2 + 0.5f; bl.radius = val * ratio2 + 1; bl.UpdateParam(); }); t[1].onValueChanged.AddListener((float val) => { val = val / 2 + 0.5f; bl.intensity = val * ratio; bl.UpdateParam(); }); dm.colorPick(fs, i, transform.GetChild(0).gameObject); bl.enabled = true; return; case itemType.RPamp: Ramp r = Camera.main.gameObject.GetComponent <Ramp>(); if (!isEquipped()) { dm.x.onClick.AddListener(() => { dm.fm.Remove("RP"); }); cpa.Color = Color.blue; } else { cpa.Color = r.FirstColor; Color c0 = r.FirstColor, c1 = r.SecondColor; float a = r._opacity; dm.x.onClick.AddListener(() => { r.FirstColor = c0; r.SecondColor = c0; r._opacity = a; r.updateColors(); }); } Iris lr2 = cpa.getLeftRight(); TurnCanvas(lr2.transform, true); string bo, to; switch (l) { case 1: //chinese bo = "降低"; to = "上"; break; case 2: //ja bo = "低い"; to = "アッパー"; break; case 3: //rus bo = "ниже"; to = "Вверх"; break; case 4: bo = "inferior"; to = "superior"; break; case 5: //thai bo = "โคน"; to = "ด้านบน"; break; case 6: bo = "inférieur"; to = "supérieur"; break; default: //english bo = "bottom"; to = "top"; break; } lr2.fillButtons(bo, to, () => { r.FirstColor = cpa.Color; r.updateColors(); }, () => { r.SecondColor = cpa.Color; r.updateColors(); } ); Slider s2 = getOpacitySlider(cpa.transform); s2.value = r._opacity; s2.onValueChanged.AddListener((float val) => { r._opacity = val; r.updateColors(); }); dm.x.onClick.AddListener(() => { s2.gameObject.SetActive(false); lr2.gameObject.SetActive(false); TurnCanvas(lr2.transform, false); }); cpa.Reset(); lr2.setListeners(); r.enabled = true; break; case itemType.CXolor: ColorFX fx = Camera.main.gameObject.GetComponent <ColorFX>(); if (!isEquipped()) { dm.x.onClick.AddListener(() => { dm.fm.Remove("CX"); }); cpa.Color = new Color(0.4f, 0.4f, 0.4f, 1); } else { cpa.Color = fx.color; Color prev = fx.color; dm.x.onClick.AddListener(() => { fx.color = prev; fx.updateColor(); }); } cpa.Reset(); cpa.clearUpdateColor(); cpa.UpdateColorAction += () => { fx.color = cpa.Color; fx.updateColor(); }; Slider s3 = getOpacitySlider(cpa.transform); TurnCanvas(s3.transform, true); s3.value = fx.Amount; s3.onValueChanged.AddListener((float val) => { fx.Amount = val; fx.updateColor(); }); dm.x.onClick.AddListener(() => { s3.gameObject.SetActive(false); TurnCanvas(s3.transform, false); }); fx.enabled = true; break; case itemType.wdEluxeScript: if (!isEquipped()) { dm.x.onClick.AddListener(() => { dm.fm.XtraStuff.Remove(key); Destroy(dm.fm.transform.Find(key).gameObject); }); } else { cpa.Color = fs.set.color; cpa.Reset(); } break; case itemType.wfFallScript: if (!isEquipped()) { dm.x.onClick.AddListener(() => { dm.fm.XtraStuff.Remove(key); Destroy(dm.fm.transform.Find(key).gameObject); }); } else { cpa.Color = fs.set.GetComponent <WaterfallScript>().LightColor; cpa.Reset(); } break; case itemType.FRGradient: FourGradient fg; bool e = isEquipped(); if (!e) { dm.fm.bangs.GetComponent <SoftMask>().enabled = false; dm.fm.bangs.transform.GetChild(0).gameObject.SetActive(false); fg = dm.fm.bangs.gameObject.AddComponent <FourGradient>(); dm.fm.hair.material = dm.fm.bangs.materialForRendering; dm.x.onClick.AddListener(() => { dm.fm.Remove(key); }); } else { fg = dm.fm.bangs.gameObject.GetComponent <FourGradient>(); cpa.Color = fg._Color1; Color c0 = fg._Color1, c1 = fg._Color2, c2 = fg._Color3, c3 = fg._Color4; float o = fg.opacity; dm.x.onClick.AddListener(() => { fg._Color1 = c0; fg._Color2 = c1; fg._Color3 = c2; fg._Color4 = c3; fg.opacity = o; fg.updateParams(); }); } Iris lr4 = cpa.getLeftRight(); TurnCanvas(lr4.transform, true); string bo2, to2, bo3, to3; //t l, t r, b l , b r switch (l) { case 1: case 2: bo2 = "左上"; to2 = "右上"; bo3 = "左下"; to3 = "右下"; break; case 3: //rus bo2 = "верхний левый"; to2 = "правом верхнем"; bo3 = "Нижняя левая"; to3 = "внизу справа"; break; case 4: bo2 = "izquierda superior"; to2 = "derecha superior"; bo3 = "izquierda inferior"; to3 = "derecha inferior"; //spansih break; case 5: //thai bo2 = "บนซ้าย"; to2 = "ด้านบนขวา"; bo3 = "ล่างซ้าย"; to3 = "ล่างขวา"; break; case 6: bo2 = "haut gauche"; to2 = "haut droite"; bo3 = "bas gauche"; to3 = "bas droite"; break; default: //english bo2 = "top left"; to2 = "top right"; bo3 = "bottom left"; to3 = "bottom right"; break; } lr4.fillButtons(bo2, to2, () => { fg._Color1 = cpa.Color; fg.updateSingleParam(1); }, () => { fg._Color2 = cpa.Color; fg.updateSingleParam(2); } ); lr4.fill2MoreButtons(bo3, to3, () => { fg._Color3 = cpa.Color; fg.updateSingleParam(3); }, () => { fg._Color4 = cpa.Color; fg.updateSingleParam(4); }, dm.x, e ? lr4.transform.parent.GetChild(0).GetComponent <Button>() : null ); Slider sFG = getOpacitySlider(cpa.transform); sFG.value = fg.opacity; sFG.onValueChanged.AddListener((float val) => { fg.opacity = val * 0.9f; fg.updateParams(); }); dm.x.onClick.AddListener(() => { sFG.gameObject.SetActive(false); lr4.gameObject.SetActive(false); TurnCanvas(lr4.transform, false); }); cpa.Reset(); lr4.setListeners(); break; } cpa.gameObject.SetActive(true); dm.colorPick(fs, i, transform.GetChild(0).gameObject); }
public void colorPick(UndoInfo ui, itemType it, GameObject equipped) { CanvasGroup du = transform.GetChild(0).GetComponent <CanvasGroup>(); CanvasGroup cp = cpa.transform.root.GetComponent <CanvasGroup>(); TurnOff(du, false); Color bg = Camera.main.backgroundColor; x.onClick.AddListener(() => { UndoChanges(ui); if (equipped) { cpa.transform.parent.GetChild(3).gameObject.SetActive(false); } TurnOff(cp, false); TurnOn(du, true); x.onClick.RemoveAllListeners(); }); setCPAListeners(ui); HashSet <string> s = new HashSet <string>(new string[] { "b_", "ir", "w_", "ey", "bh", "e_", "eb", "l_", "n_", "bg", "BY", "CH", "HD" }); if (equipped.activeSelf && !s.Contains(it.ToString().Substring(0, 2))) { Button remove = cpa.transform.parent.GetChild(4).GetChild(0).GetComponent <Button>(); CanvasGroup cg = remove.transform.parent.GetComponent <CanvasGroup>(); cg.alpha = 1; cg.interactable = true; cg.blocksRaycasts = true; remove.gameObject.SetActive(true); remove.onClick.AddListener(() => { equipped.SetActive(false); fm.Remove(it.ToString().Substring(0, 2)); x.onClick.RemoveAllListeners(); TurnOff(cp, false); TurnOn(du, true); // remove.transform.parent.GetChild(4).gameObject.SetActive(false); remove.gameObject.SetActive(false); remove.onClick.RemoveAllListeners(); cg.alpha = 0; cg.interactable = false; cg.blocksRaycasts = false; }); x.onClick.AddListener(() => { cg.alpha = 0; cg.interactable = false; cg.blocksRaycasts = false; }); } TurnOn(cp, false); }
IEnumerator randHelper() { if (dm.cpa == null) { dm.callSwitch(); yield return(null); } yield return(null); while (dm.cpa == null) { yield return(null); } while (dm.load.loaddd) { yield return(null); } if (dm.cpa != null) { dm.cpa.gameObject.SetActive(false); } int length = UnityEngine.Random.Range(0, itemType.GetNames(typeof(itemType)).Length - 10); length /= 2; HashSet <int> enums = new HashSet <int>(); enums.Add((int)itemType.ebrow); enums.Add((int)itemType.bh_air); enums.Add((int)itemType.b_ngs); enums.Add((int)itemType.e_ye); enums.Add((int)itemType.bg); enums.Add((int)itemType.t_clothes); for (int i = 0; i < length; i++) { enums.Add(UnityEngine.Random.Range(5, (int)itemType.particle_snow)); } enums.Add((int)itemType.skin); /* * bugs: * cpa not loaded in time * * randomize * * * test save/load * */ List <UndoInfo> uiArr = new List <UndoInfo>(); itemType[][] BadMatches = new itemType[][] { new itemType[] { itemType.msk, itemType.b0odnos, itemType.bood, itemType.JBandage, itemType.lippiercing, itemType.bubble }, new itemType[] { itemType.bood, itemType.starfreckles }, new itemType[] { itemType.BOW, itemType.chneckwear }, new itemType[] { itemType.bronzer, itemType.UEye }, new itemType[] { itemType.glasses, itemType.EPatch, itemType.scar }, new itemType[] { itemType.harts, itemType.flower }, new itemType[] { itemType.freckles, itemType.starfreckles, itemType.bDaid }, new itemType[] { itemType.hesidehorn, itemType.unicorn, itemType.eear, itemType.flower }, }; foreach (itemType[] iList in BadMatches) { itemType i1 = iList[0]; foreach (itemType i2 in iList) { if (enums.Contains((int)i1) && enums.Contains((int)i2)) { enums.Remove((UnityEngine.Random.value > 0.5f) ? (int)i1 : (int)i2); } } } Color bg = dm.fm.bg.color; HashSet <string> s = new HashSet <string>(new string[] { "b_", "ir", "w_", "ey", "bh", "e_", "eb", "l_", "n_", "bg", "BY", "CH", "HD", "t_", }); Button check = dm.cpa.transform.parent.GetChild(1).GetComponent <Button>(); check.onClick.RemoveAllListeners(); foreach (var i in Enum.GetValues(typeof(itemType))) { itemType it = (itemType)i; Sprite newT = getRandomSprite(it); string key = it.ToString().Substring(0, 2); if (newT != null && !s.Contains(key) && dm.fm.XtraStuff.ContainsKey(key)) { if (dm.fm.XtraStuff[key] != null) { dm.fm.XtraStuff[key].gameObject.SetActive(false); //make remove undoable if (dm.fm.XtraStuff.ContainsKey(key + "2")) { dm.fm.XtraStuff[key + "2"].gameObject.SetActive(false); dm.x.onClick.AddListener(() => { dm.fm.XtraStuff[key].gameObject.SetActive(true); dm.fm.XtraStuff[key + "2"].gameObject.SetActive(true); }); } else { dm.x.onClick.AddListener(() => { dm.fm.XtraStuff[key].gameObject.SetActive(true); }); } check.onClick.AddListener(() => { dm.fm.Remove(key); }); } } else if (enums.Contains((int)i)) { uiArr.Add(dm.fm.faceSet(newT, it)); //if heart.. if (it == itemType.harts && GameObject.FindGameObjectWithTag("Finish").transform.Find("hartic") == null) { dm.setUpParticles(dm.xtra[16], 1, Color.white, true); } // else if (it == itemType.particles) dm.setUpParticles(uiArr[count].before, 0); } } dm.colorPick(uiArr); randomizeParams(dm.fm, dm.x); yield return(null); CanvasGroup cp = dm.cpa.transform.root.GetComponent <CanvasGroup>(); check.onClick.AddListener(() => { dm.TurnOffEnd(cp); }); dm.x.onClick.AddListener(() => { check.onClick.RemoveAllListeners(); check.onClick.AddListener(() => dm.TurnOffEnd(cp)); }); RandomizeColors(uiArr, bg); }
public void refresh(GameData.Item item, string instanceID, itemType mask) { this.Item = item; this.InstanceName = instanceID; this.Instance = item.getInstance(instanceID); GameData gameDatum = this.nav.ou.gameData; string str = this.Instance.sdata["ref"]; object obj = gameDatum.getItem(str); if (obj == null) { obj = str; } bool state = this.Instance.getState() == GameData.State.LOCKED; Color stateColor = StateColours.GetStateColor((state ? GameData.State.LOCKED : GameData.State.ORIGINAL)); string str1 = ""; if (mask == itemType.NULL_ITEM) { str1 = "is node=true"; } this.grid.addItem("Base", "Parent Item", this.Item, "The item this instance belongs to", new Color?(SystemColors.GrayText), false); this.grid.addItem("Base", "Instance ID", this.InstanceName, "Unique identifier for this instance. Works the same as StringID but for instances", new Color?(stateColor), !state); this.grid.addItem("Base", "Target", obj, "Game object that is instanced", new Color?(stateColor), !state).Property = new GameDataItemProperty(gameDatum, mask, str1); GameData.State state1 = this.Instance.getState("ref"); if (state && state1 != GameData.State.INVALID) { state1 = GameData.State.LOCKED; } this.grid.getItem("Target").TextColour = StateColours.GetStateColor(state1); this.setItem("Position", "X", "x", "Instance position"); this.setItem("Position", "Y", "y", "Instance position"); this.setItem("Position", "Z", "z", "Instance position"); this.setItem("Orientation", "W", "qw", "Instance oriantetion (quaternion)"); this.setItem("Orientation", "X", "qx", "Instance oriantetion (quaternion)"); this.setItem("Orientation", "Y", "qy", "Instance oriantetion (quaternion)"); this.setItem("Orientation", "Z", "qz", "Instance oriantetion (quaternion)"); foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in this.Instance.referenceData("states", false)) { GameData.Item item1 = this.nav.ou.gameData.getItem(keyValuePair.Key); if (item1 == null) { continue; } PropertyGrid.PropertyGrid propertyGrid = this.grid; itemType _itemType = item1.type; Color? nullable = null; PropertyGrid.PropertyGrid.Item gameDataItemProperty = propertyGrid.addItem("State Data", _itemType.ToString(), item1, "Instance state data", nullable, true); gameDataItemProperty.Property = new GameDataItemProperty(gameDatum, item1.type, ""); gameDataItemProperty.Editable = false; } this.grid.AutosizeDivider(); }
public void Save(TMP_InputField t, int n, int overwrite = -1) { n = (overwrite == -1) ? getNext() : n; DressManager dm = transform.root.GetComponent <DressManager>(); dm.load.startLoading(true); string num = n.ToString(); string key = "SAVE" + num; if (overwrite == -1) { Debug.LogWarning("saving at " + key); PlayerPrefs.SetString(key, t.text); } //save all face things with key + "face", key + "bh"; etc foreach (var i in Enum.GetValues(typeof(itemType))) { itemType it = (itemType)i; string keyItem = i.ToString().Substring(0, 2); if (keyItem == "CH") { Vector2 chin = dm.fm.skin[8].rectTransform.sizeDelta; PlayerPrefs.SetString(num + keyItem, chin.y + ""); continue; } else if (keyItem == "BY") { Vector2 body = dm.fm.skin[4].rectTransform.sizeDelta; PlayerPrefs.SetString(num + keyItem, body.x + "|" + body.y); continue; } else if (keyItem == "HD") { Vector2 head = dm.fm.skin[1].rectTransform.sizeDelta; PlayerPrefs.SetString(num + keyItem, head.x + "|" + head.y); continue; } if (dm.fm.XtraStuff.ContainsKey(keyItem)) { string colors; string name; if (dm.fm.XtraStuff[keyItem] != null && dm.fm.XtraStuff[keyItem].sprite != null) { name = dm.fm.XtraStuff[keyItem].sprite.name; } else { name = " "; } if (it == itemType.bg) { Color32 tempC = Camera.main.backgroundColor; colors = tempC.r + "," + tempC.g + "," + tempC.b; if (name != " " && name[2] == 'p') { tempC = dm.fm.XtraStuff[keyItem].color; colors += "|" + tempC.r + "," + tempC.g + "," + tempC.b; } } else if (it == itemType.GXlitch) { Glitch g = Camera.main.GetComponent <Glitch>(); colors = g.colorDrift + "|" + g.verticalJump; } else if (it == itemType.CXolor) { ColorFX g = Camera.main.GetComponent <ColorFX>(); Color32 tempC = g.color; colors = tempC.r + "," + tempC.g + "," + tempC.b + "|" + g.Amount; } else if (it == itemType.BNry) { Binary g = Camera.main.GetComponent <Binary>(); Color32 tempC = g.color0; Color32 tempC2 = g.color1; colors = tempC.r + "," + tempC.g + "," + tempC.b + "|" + tempC2.r + "," + tempC2.g + "," + tempC2.b + "|" + g.Opacity; } else if (it == itemType.RPamp) { Ramp g = Camera.main.GetComponent <Ramp>(); Color32 tempC = g.FirstColor; Color32 tempC2 = g.SecondColor; colors = tempC.r + "," + tempC.g + "," + tempC.b + "|" + tempC2.r + "," + tempC2.g + "," + tempC2.b + "|" + g._opacity; } else if (it == itemType.BMlm) { Bloom g = Camera.main.GetComponent <Bloom>(); colors = g.intensity + "|" + g.radius; } else { Color32 tempC; if (keyItem.ToLower() == "pa") { Transform ps = GameObject.FindGameObjectWithTag("Finish").transform.Find(it.ToString()); if (ps == null) { continue; } tempC = ps.GetComponent <ParticleSystem>().main.startColor.colorMin; colors = tempC.r + "," + tempC.g + "," + tempC.b; } else if (keyItem == "wf") { tempC = dm.fm.XtraStuff[keyItem].GetComponent <WaterfallScript>().LightColor; colors = tempC.r + "," + tempC.g + "," + tempC.b; } else if (keyItem == "FR") { FourGradient fg = dm.fm.bangs.GetComponent <FourGradient>(); tempC = fg._Color1; colors = tempC.r + "," + tempC.g + "," + tempC.b + "|"; tempC = fg._Color2; colors += tempC.r + "," + tempC.g + "," + tempC.b + "|"; tempC = fg._Color3; colors += tempC.r + "," + tempC.g + "," + tempC.b + "|"; tempC = fg._Color4; colors += tempC.r + "," + tempC.g + "," + tempC.b + "|"; colors += fg.opacity.ToString(); } else { tempC = dm.fm.XtraStuff[keyItem].color; colors = tempC.r + "," + tempC.g + "," + tempC.b; if (keyItem == "bh") { Vector2 size = dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta; colors += "|" + size.x + "," + size.y; } else if (keyItem == "b_") { Vector2 size = dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta; colors += "|" + size.x + "," + size.y; } else if (keyItem == "l_") { Vector2 size = dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta; colors += "|" + size.x + "," + size.y + "|" + dm.fm.VertLip; } else if (keyItem == "eb") { colors += "|" + dm.fm.XtraStuff[keyItem].rectTransform.eulerAngles.z + "|" + dm.fm.VertEB; } else if (keyItem == "e_") { RectTransform r = dm.fm.XtraStuff[keyItem].rectTransform; colors += "|" + r.sizeDelta.x + "," + r.sizeDelta.y + "|" + r.eulerAngles.z; } else if (keyItem == "ey") { RectTransform r2 = dm.fm.skin[5].rectTransform; colors += "|" + r2.anchoredPosition.y + "|" + r2.eulerAngles.z; } else if (dm.fm.XtraStuff.ContainsKey(keyItem + "2")) { Image im2 = dm.fm.XtraStuff[keyItem + "2"]; if (im2 != null) { tempC = im2.color; colors += "|" + tempC.r + "," + tempC.g + "," + tempC.b; if (keyItem == "ir") { colors += "|" + dm.fm.leftE[1].rectTransform.sizeDelta.x + "," + dm.fm.leftE[1].rectTransform.sizeDelta.y; }//iris.sizeDelta = new Vector2(120.2f + ratio * val, 107.8f + ratio * val); } } } } string val = name + "|" + colors; PlayerPrefs.SetString(num + keyItem, val); Debug.LogWarning("save" + num + keyItem + " as: " + val); } } PlayerPrefs.SetFloat(num + "HE", dm.fm.HorzEye); PlayerPrefs.SetFloat(num + "VE", dm.fm.VertEye); PlayerPrefs.SetFloat(num + "VN", dm.fm.VertNose); PlayerPrefs.SetFloat(num + "SN", dm.fm.skin[0].rectTransform.sizeDelta.y - 304); // fs.set.rectTransform.sizeDelta = new Vector2(349 + ratio2 * val, 304 + ratio2 * val); // public float HorzEye, VertEye, VertNose, noseSize // Color32 c = dm.fm.leftE[1].color; // PlayerPrefs.SetString(num + "lI", c.r + "," + c.g + "," + c.b); // c = dm.fm.rightE[1].color; // PlayerPrefs.SetString(num + "rI", c.r + "," + c.g + "," + c.b); // c = dm.fm.leftE[0].color; // PlayerPrefs.SetString(num + "W", c.r + "," + c.g + "," + c.b); // c = dm.fm.rightE[0].color; // PlayerPrefs.SetString(num + "Wr", c.r + "," + c.g + "," + c.b); Color32 c = dm.fm.skin[1].color; PlayerPrefs.SetString(num + "S", c.r + "," + c.g + "," + c.b); /* * * hm.set = leftE[1]; * hm.set2 = rightE[1]; * hm.before = hm.set.sprite; * break; * case "whites": * hm.set = leftE[0]; * hm.set2 = rightE[0]; */ if (overwrite == -1) { Button b = InstantiateButton(PlayerPrefs.GetString(key), n); Color32 prev = new Color32((byte)PlayerPrefs.GetInt("themeR"), (byte)PlayerPrefs.GetInt("themeG"), (byte)PlayerPrefs.GetInt("themeB"), 255); ColorBlock cb = b.colors; cb.normalColor = prev; cb.disabledColor = prev; b.colors = cb; setNext(n); } PlayerPrefs.Save(); dm.load.StopLoading(); }