Exemplo n.º 1
0
        private static Action ParseLine(string line, int lineIndex)
        {
            if (string.IsNullOrWhiteSpace(line))
            {
                return(new Action());
            }

            var lineParts = line.Replace("\r", "").Split(LineSeparator);

            if (lineParts.Length != ExpectedLineParts)
            {
                throw new Exception($"Drinks line {lineIndex} has {lineParts.Length} parts, expected {ExpectedLineParts}.");
            }

            var action = new Action
            {
                Name                 = lineParts[NameLinePartIndex],
                ControlType          = ActionControlType.DrinkButton,
                Text                 = lineParts[TextLinePartIndex],
                ActionPoints         = DrinkActionPoints,
                AdditionalProperties = new Dictionary <string, string>
                {
                    { DrinkAdditionalProperties.DrinkType, lineParts[DrinkTypeLinePartIndex] }
                }
            };

            return(action);
        }
Exemplo n.º 2
0
        protected override GameObject GetButtonPrefab(Action action, GameObject layoutGameObject)
        {
            var horizontalParentLayout = layoutGameObject.GetComponent <HorizontalLayoutGroup>();

            return(horizontalParentLayout != null
                ? GetHorizontalButtonPrefab(action)
                : GetVerticalButtonPrefab(action));
        }
Exemplo n.º 3
0
        private GameObject GetHorizontalButtonPrefab(Action action)
        {
            if (action.Values.Length == 5)
            {
                return(_multiValueSliderHorizontal5Prefab);
            }

            throw GetInvalidNumberOfValuesException(action.Values.Length);
        }
Exemplo n.º 4
0
        protected override void SetUpButton(GameObject button, Action action, string playerPeerId)
        {
            var controller = button.GetComponent <MultiValueSliderController>();

            controller.SetUp(action.Name, action.Text, playerPeerId, action.Values, action.ValuesTexts);
        }