public void DoTransition() { if (GameObject.Find("DEMO") != null) { var list = sploader.GetSpritesName(); int idx = Random.Range(0, list.Count); effectName = list[idx]; } else { var wsclient = GameObject.Find("WSClient").GetComponent <WSClient>(); int idx = Random.Range(0, wsclient.arData.EnabledEffects.Count); effectName = wsclient.arData.EnabledEffects[idx]; } Debug.Log(effectName); currentColor = Random.Range(0, 4); Effect.GetComponent <Image>().sprite = sploader.GetSprite(effectName); Effect.GetComponent <Image>().color = colors[currentColor]; isTransition = true; Effect.SetActive(true); Arrow.SetActive(true); effectInitPos = Effect.transform.position; }
private void Start() { // いいね!スプライトロード sploader = new SpriteLoader(); sploader.Load("LikeEffects"); // 全てのエフェクトのチェックボックスと画像の表示 var parent = this.transform.Find("Viewport").Find("Content"); var effectNames = sploader.GetSpritesName(); Effects = effectNames.ToDictionary(eff => eff, val => true); foreach (var name in effectNames) { var item = Object.Instantiate(Template, parent) as GameObject; item.SetActive(true); var image = item.transform.Find("Image").GetComponent <Image>(); image.sprite = sploader.GetSprite(name); image.color = Color.black; item.transform.Find("Toggle").GetComponent <Toggle>().onValueChanged.AddListener((value) => { Effects[name] = value; }); } }