protected virtual IEnumerable <Field> GetFields(FieldTarget target) { switch (target) { case FieldTarget.KeyReference: return(LookupTableBuilder.Schema.Keys.Select(fp => fp.Value.Affix(PrefixName).Affix(ReferenceNameFormatter).AsNullableReference(Key ? FieldType.Key : FieldType.Dimension).ChangeSort(SortOrder.Unspecified))); case FieldTarget.Inline: var fields = FieldMappers.SelectMany(mapper => mapper.Fields.Select(field => field.Affix(PrefixName).Affix(ReferenceNameFormatter))).ToArray(); if (!Key) { foreach (var field in fields.Where(f => f.FieldType == FieldType.Key)) { field.FieldType = FieldType.Dimension; } } return(fields); case FieldTarget.Table: return(FieldMappers.SelectMany(mapper => mapper.Fields)); } throw new ArgumentOutOfRangeException("target"); }
// Starting a new game session public void StartSession(FieldTarget sessionType, Limitation limitationType) { StopAllCoroutines(); // Ending of all current coroutines AudioAssistant.main.PlayMusic("Field"); // Running music switch (limitationType) // Start corresponding coroutine depending on the limiation mode { case Limitation.Moves: StartCoroutine(MovesLimitation()); break; case Limitation.Time: StartCoroutine(TimeLimitation()); break; } switch (sessionType) // Start corresponding coroutine depending on the target level { case FieldTarget.Score: StartCoroutine(ScoreSession()); break; case FieldTarget.Jelly: StartCoroutine(JellySession()); break; case FieldTarget.Block: StartCoroutine(BlockSession()); break; case FieldTarget.Color: StartCoroutine(ColorSession()); break; case FieldTarget.SugarDrop: StartCoroutine(SugarDropSession()); break; } StartCoroutine(BaseSession()); // Base routine of game session StartCoroutine(ShowingHintRoutine()); // Coroutine display hints StartCoroutine(ShuffleRoutine()); // Coroutine of mixing chips at the lack moves StartCoroutine(FindingSolutionsRoutine()); // Coroutine of finding a solution and destruction of existing combinations of chips StartCoroutine(IllnessRoutine()); // Coroutine of Weeds logic }
public void Construct(FieldTarget fieldTarget) { if (_listallViewCellTarget.Count == 0) { _viewCellTarget.gameObject.SetActive(false); foreach (string name in Enum.GetNames(typeof(FieldTarget))) { if (name == "None") { continue; } GameObject temp = Instantiate(_viewCellTarget.gameObject); temp.transform.SetParent(_viewCellTarget.gameObject.transform.parent, false); ViewCellTarget v = temp.GetComponent <ViewCellTarget>(); v.nameTarget.text = name; _listallViewCellTarget.Add(v); v.toggle.onValueChanged.AddListener( (ViewCellTarget) => { ActivateTarget(v); }); FieldTarget ft = (FieldTarget)Enum.Parse(typeof(FieldTarget), name); switch (ft) { case FieldTarget.Block: v.PanelToActivate = null; break; case FieldTarget.SugarDrop: v.PanelToActivate = _sugarDropPanel.gameObject; break; case FieldTarget.Color: v.PanelToActivate = _targetColorPanel.gameObject; break; } temp.SetActive(true); } } ChangeTarget(fieldTarget); }
private void ChangeTarget(FieldTarget fg) { var v = _listallViewCellTarget.Find(x => x.nameTarget.text == fg.ToString()); if (v != null) { v.toggle.isOn = true; } }
public void StartSession(FieldTarget sessionType) { StopAllCoroutines(); AudioAssistant.main.PlayMusic("Field"); timeLeft = LevelProfile.main.duraction; isPlaying = true; score = 0; switch (sessionType) { case FieldTarget.Score: StartCoroutine(ScoreSession()); break; case FieldTarget.Timer: StartCoroutine(TimerSession()); break; case FieldTarget.Jelly: StartCoroutine(JellySession()); break; } StartCoroutine(ShowingHintRoutine()); StartCoroutine(ShuffleRoutine()); StartCoroutine(FindingSolutionsRoutine()); }
protected bool SetValues(FieldTarget target, ProcessingScope context, IList <object> row) { switch (target) { case FieldTarget.Inline: return(_iterator.SetValues(row, context)); case FieldTarget.KeyReference: var i = 0; foreach (var key in LookupTableBuilder.Schema.Keys) { row[i] = LookupTableBuilder.CurrentRow[key.Index]; ++i; } return(true); } throw new ArgumentOutOfRangeException("target"); }
// Starting a new game session public void StartSession(FieldTarget sessionType, Limitation limitationType) { StopAllCoroutines (); // Ending of all current coroutines isPlaying = true; blockCountTotal = GameObject.FindObjectsOfType<Block>().Length; switch (limitationType) { // Start corresponding coroutine depending on the limiation mode case Limitation.Moves: StartCoroutine(MovesLimitation()); break; case Limitation.Time: StartCoroutine(TimeLimitation());break; } switch (sessionType) { // Start corresponding coroutine depending on the target level case FieldTarget.None: StartCoroutine(TargetSession(() => { return true; })); break; case FieldTarget.Jelly: jellyCountTotal = GameObject.FindObjectsOfType<Jelly>().Length; Jelly.need_to_update_potentials = true; StartCoroutine(TargetSession(() => { return GameObject.FindObjectsOfType<Jelly>().Length == 0; })); break; case FieldTarget.Block: StartCoroutine(TargetSession(() => { return GameObject.FindObjectsOfType<Block>().Length == 0; })); break; case FieldTarget.Color: for (int i = 0; i < LevelProfile.main.countOfEachTargetCount.Length; i++) countOfEachTargetCount[colorMask[i]] = LevelProfile.main.countOfEachTargetCount[i]; StartCoroutine(TargetSession(() => { foreach (int c in countOfEachTargetCount) if (c > 0) return false; return true; })); break; case FieldTarget.SugarDrop: targetSugarDropsCount = 0; creatingSugarDropsCount = LevelProfile.main.targetSugarDropsCount; StartCoroutine(TargetSession(() => { return targetSugarDropsCount >= LevelProfile.main.targetSugarDropsCount && GameObject.FindObjectsOfType<SugarChip>().Length == 0; })); break; } StartCoroutine (BaseSession()); // Base routine of game session StartCoroutine (ShowingHintRoutine()); // Coroutine display hints StartCoroutine (ShuffleRoutine()); // Coroutine of mixing chips at the lack moves StartCoroutine (FindingSolutionsRoutine()); // Coroutine of finding a solution and destruction of existing combinations of chips StartCoroutine (IllnessRoutine()); // Coroutine of Weeds logic }
protected virtual IEnumerable<Field> GetFields(FieldTarget target) { switch (target) { case FieldTarget.KeyReference: return LookupTableBuilder.Schema.Keys.Select(fp => fp.Value.Affix(PrefixName).Affix(ReferenceNameFormatter).AsNullableReference(Key ? FieldType.Key : FieldType.Dimension).ChangeSort(SortOrder.Unspecified)); case FieldTarget.Inline: var fields = FieldMappers.SelectMany(mapper => mapper.Fields.Select(field => field.Affix(PrefixName).Affix(ReferenceNameFormatter))).ToArray(); if (!Key) { foreach (var field in fields.Where(f=>f.FieldType==FieldType.Key)) { field.FieldType = FieldType.Dimension; } } return fields; case FieldTarget.Table: return FieldMappers.SelectMany(mapper => mapper.Fields); } throw new ArgumentOutOfRangeException("target"); }
protected bool SetValues(FieldTarget target, ProcessingScope context, IList<object> row) { switch (target) { case FieldTarget.Inline: return _iterator.SetValues(row, context); case FieldTarget.KeyReference: var i = 0; foreach(var key in LookupTableBuilder.Schema.Keys) { row[i] = LookupTableBuilder.CurrentRow[key.Index]; ++i; } return true; } throw new ArgumentOutOfRangeException("target"); }
// Starting a new game session public void StartSession(FieldTarget sessionType, Limitation limitationType) { }
// Starting a new game session public void StartSession(FieldTarget sessionType, Limitation limitationType) { StopAllCoroutines (); // Ending of all current coroutines AudioAssistant.main.PlayMusic ("Field"); // Running music switch (limitationType) { // Start corresponding coroutine depending on the limiation mode case Limitation.Moves: StartCoroutine(MovesLimitation()); break; case Limitation.Time: StartCoroutine(TimeLimitation());break; } switch (sessionType) { // Start corresponding coroutine depending on the target level case FieldTarget.Score: StartCoroutine(ScoreSession()); break; case FieldTarget.Jelly: StartCoroutine(JellySession()); break; case FieldTarget.Block: StartCoroutine(BlockSession()); break; case FieldTarget.Color: StartCoroutine(ColorSession()); break; case FieldTarget.SugarDrop: StartCoroutine(SugarDropSession()); break; } StartCoroutine (BaseSession()); // Base routine of game session StartCoroutine (ShowingHintRoutine()); // Coroutine display hints StartCoroutine (ShuffleRoutine()); // Coroutine of mixing chips at the lack moves StartCoroutine (FindingSolutionsRoutine()); // Coroutine of finding a solution and destruction of existing combinations of chips StartCoroutine (IllnessRoutine()); // Coroutine of Weeds logic }