private void InitializeView() { // prototyping _buttonTurn = transform.FindOnAllChildren <Button>(_ => _.name.Contains("turn")).SingleOrDefault(); _buttonTurn.onClick.AddListener(OnTurn); // using (var enumerator = _repository.GetAllOptions().GetEnumerator()) { enumerator.MoveNext(); var option_00 = enumerator.Current; _buttonOpt0 = transform.FindOnAllChildren <Button>(_ => _.name.Contains("opt_00")).SingleOrDefault(); _buttonOpt0.onClick.AddListener(() => OnBet(option_00)); _imageOpt0 = _buttonOpt0.transform.FindOnAllChildren <Image>(_ => _.name.Contains("icon")).SingleOrDefault(); _imageOpt0.sprite = option_00.Sprite; // enumerator.MoveNext(); var option_01 = enumerator.Current; _buttonOpt1 = transform.FindOnAllChildren <Button>(_ => _.name.Contains("opt_01")).SingleOrDefault(); _buttonOpt1.onClick.AddListener(() => OnBet(option_01)); _imageOpt1 = _buttonOpt1.transform.FindOnAllChildren <Image>(_ => _.name.Contains("icon")).SingleOrDefault(); _imageOpt1.sprite = option_01.Sprite; // enumerator.MoveNext(); var option_02 = enumerator.Current; _buttonOpt2 = transform.FindOnAllChildren <Button>(_ => _.name.Contains("opt_02")).SingleOrDefault(); _buttonOpt2.onClick.AddListener(() => OnBet(option_02)); _imageOpt2 = _buttonOpt2.transform.FindOnAllChildren <Image>(_ => _.name.Contains("icon")).SingleOrDefault(); _imageOpt2.sprite = option_02.Sprite; } // _iconBetOwn = transform.FindOnAllChildren <Image>(_ => _.name.Contains("bet_own")).SingleOrDefault(); _iconBetFoe = transform.FindOnAllChildren <Image>(_ => _.name.Contains("bet_foe")).SingleOrDefault(); // _textCount = transform.FindOnAllChildren <Text>(_ => _.name.Contains("counter")).SingleOrDefault(); _textLog = transform.FindOnAllChildren <Text>(_ => _.name.Contains("log")).SingleOrDefault(); RenderLog(); }
public IOption GetOption() { var total = _repository.GetAllOptions().ToArray(); return(total.Take(Random.Range(1, total.Length)).Last()); }