private void CommandClick_Execute(string character)
        {
            switch (character)
            {
            case "^":
                // Mayus
                if (characters[0] == 'q')
                {
                    characters = characters.ToUpper();
                }
                else
                {
                    characters = characters.ToLower();
                }

                RaisePropertyChanged("CharactersRow1");
                RaisePropertyChanged("CharactersRow2");
                RaisePropertyChanged("CharactersRow3");
                break;

            case "<":
                // Delete
                StringVar = StringVar.Remove(StringVar.Length - 1);
                return;

            default:
                StringVar += character;
                break;
            }
        }
 public override void Enter()
 {
     if (variableFieldType == eVariableFieldType.Global)
     {
         variableStore = (StringVar)GlobalVariables.GetVariable <string>(variableId);
     }
 }
    public Node Factor()
    {
        Node result = null;

        if (CurrentToken().type.Equals("LEFT_PAREN"))
        {
            MatchAndEat("LEFT_PAREN");
            result = v8Expression();
            MatchAndEat("RIGHT_PAREN");
        }
        else if (CurrentToken().type.Equals("NUMBER"))
        {
            Token token = MatchAndEat("NUMBER");
            result = new Number(Double.Parse(token.text));
            //try{Console.WriteLine("factor"+result.opinion());}catch(NullReferenceException){Console.WriteLine("Factor");}
        }
        else if (CurrentToken().type.Equals("STRING"))
        {
            Token token = MatchAndEat("STRING");
            result = new StringVar(token.text);
        }
        else if (CurrentToken().type.Equals("KEYWORD"))
        {
            result = Variable();
        }
        return(result);
    }
Esempio n. 4
0
        /// <summary>
        /// Shows the specified event in the DataGridView.
        /// </summary>
        /// <param name="scriptEvent">The event to show.</param>
        private void ShowEvent(Event scriptEvent)
        {
            Debug.Assert(scriptEvent != null, "Event cannot be null.");

            StringVar nameVar = new StringVar()
            {
                Value = scriptEvent.Name
            };

            nameVar.ValueChanged += (object sender, EventArgs e) => { if (IsNameValid(nameVar.Value, scriptEvent))
                                                                      {
                                                                          scriptEvent.Name = nameVar.Value;
                                                                      }
            };

            DataGridViewRow row = new DataGridViewRow()
            {
                Tag = scriptEvent
            };

            row.Cells.Add(nameVar.GetGridCell());
            row.Cells.Add(new DataGridViewButtonCell()
            {
                Value = "X"
            });

            settingsView.table.Rows.Add(row);
        }
Esempio n. 5
0
        public virtual void Invoke(StringVar value)
        {
            for (int i = eventListeners.Count - 1; i >= 0; i--)
            {
                eventListeners[i].OnEventInvoked(value.Value);
            }

            DebugEvent(value.Value);
        }
Esempio n. 6
0
 /// <summary>
 /// Initialize properties of Game
 /// </summary>
 protected void Start()
 {
     // obtain player name var
     m_PlayerNameVar = GlobalVariables.GetVariable <string>(playerNameId) as StringVar;
     if (m_PlayerNameVar == null)
     {
         return;
     }
     m_PlayerNameVar.value = m_Save.chaptersSave[m_Save.lastSaveSlotPlayed].playerName;
 }
Esempio n. 7
0
        protected override Status UpdateNode()
        {
            if (m_VariableId.Length == 0 || m_Variable == null)
            {
                return(Status.Error);
            }
            // obtain variable
            StringVar globalString = (StringVar)GlobalVariables.GetVariable <string>(m_VariableId);

            m_Variable.value = globalString.value;
            return(Status.Success);
        }
Esempio n. 8
0
			public override object DeepCopy()
			{
				StringVar newVar = new StringVar(_parent);
				copyAttributes(this, newVar);
				newVar._tag = _tag;
				newVar._parent = _parent;
				newVar._encoding = _encoding;
				newVar._nullTermed = _nullTermed;
				if (newVar.Values != null)
					for (int i = 0; i < newVar.Values.Count; i++)
						newVar.Values[i] = (StringVar)Values[i].DeepCopy();
				return newVar;
			}
Esempio n. 9
0
 /// <summary>
 /// Initialize camera transform
 /// </summary>
 private void Start()
 {
     m_PlayerName           = (StringVar)GlobalVariables.GetVariable <string>(GameManager.Instance.playerNameId);
     m_CameraTransform      = this.transform;
     m_InitialLocalPosition = m_CameraTransform.localPosition;
     if (Screen.height > m_OriginalScreenSize.y)
     {
         float   newHeight = (Screen.height / m_OriginalScreenSize.y) * m_CurrentWrapperHeight;
         Vector2 newSize   = m_DialogueWrapper.sizeDelta;
         newSize.y = newHeight;
         m_DialogueWrapper.sizeDelta = newSize;
         m_ChoicesWrapper.sizeDelta  = newSize;
     }
 }
Esempio n. 10
0
    public StringVar GetStringVar(string name)
    {
        if (string.IsNullOrEmpty(name))
        {
            return(null);
        }
        if (!StringVars.ContainsKey(name))
        {
            var stringVar = new StringVar();
            StringVars.Add(name, stringVar);
            return(stringVar);
        }

        return(StringVars[name]);
    }
Esempio n. 11
0
        /// <summary>
        /// Draw a string variable.
        /// <param name="rect">The position to draw the variable.</param>
        /// <param name="stringVar">The string variable to be drawn.</param>
        /// </summary>
        static void DrawStringVar(Rect rect, StringVar stringVar)
        {
            rect.yMin += 3f;
            rect.yMax -= 2f;
            rect.xMin += 6f;
            rect.xMax -= 6f;

            DrawName(new Rect(rect.x, rect.y, c_NameWidth, rect.height), stringVar);

            rect.xMin += c_NameWidth + c_Space;
            rect.xMax -= c_MinusButtonWidth + c_RightPadding;
            EditorGUI.BeginChangeCheck();
            var newValue = EditorGUI.TextField(rect, GUIContent.none, stringVar.Value);

            if (EditorGUI.EndChangeCheck() && newValue != stringVar.Value)
            {
                // Register undo
                if (stringVar.blackboard != null)
                {
                    #if UNITY_4_0_0 || UNITY_4_1 || UNITY_4_2
                    Undo.RegisterUndo(stringVar.blackboard, "Variable Value");
                    #else
                    Undo.RecordObject(stringVar.blackboard, "Variable Value");
                    #endif
                }

                // Update variable value
                stringVar.Value = newValue;
                // Set blackboard dirty flag
                if (stringVar.blackboard != null)
                {
                    EditorUtility.SetDirty(stringVar.blackboard);
                }
            }

            rect.x    += rect.width + 2f;
            rect.width = c_MinusButtonWidth;
            rect.yMin -= 2f;
            rect.yMax += 2f;
            if (GUI.Button(rect, s_Styles.iconToolbarMinus, s_Styles.invisbleButton))
            {
                s_VariableToRemove = stringVar;
            }
        }
            public TestCaseContext()
            {
                Options                 = AssetsOptions.Default;
                Var1                    = new IntVar("var1", "var1-name", 15);
                Var2                    = new StringVar("var2", "var2-name", "hello");
                NotFoundVarKey          = "var3";
                Data                    = new byte[] { 0x01, 0x02, 0x03 };
                StringData              = "1 {var=var1} 22 {var=var3} 333 {var=var2} 4444";
                ExpectedProcessedString =
                    $"1 <span class=\"{Options.VarValueSpanClass}\">{Var1.DisplayString}</span> " +
                    $"22 <span class=\"{Options.VarValueSpanClass}\">VAR NOT FOUND var3</span> " +
                    $"333 <span class=\"{Options.VarValueSpanClass}\">{Var2.DisplayString}</span> " +
                    $"4444";
                ProcessedData = new byte[] { 0x04, 0x05, 0x06 };

                OptionsService = Mock.Of <IOptions <AssetsOptions> >();
                StringEncoder  = Mock.Of <IStringEncoder>();
                VarsManager    = Mock.Of <IVarsManager>();

                Mock.Get(StringEncoder).Setup(
                    m => m.EncodeToString(Data))
                .Returns(StringData);

                Mock.Get(StringEncoder).Setup(
                    m => m.EncodeFromString(ExpectedProcessedString))
                .Returns(ProcessedData);

                Mock.Get(VarsManager).Setup(
                    m => m.GetVar(Var1.Key))
                .Returns(Var1);

                Mock.Get(VarsManager).Setup(
                    m => m.GetVar(Var2.Key))
                .Returns(Var2);

                Mock.Get(VarsManager).Setup(
                    m => m.GetVar(NotFoundVarKey))
                .Throws(new VarNotFoundException(NotFoundVarKey));
            }
        /// <summary>
        /// Shows the specified named variable in the DataGridView.
        /// </summary>
        /// <param name="variable">The named variable to show.</param>
        private void ShowVariable(NamedVariable variable)
        {
            Debug.Assert(variable != null, "Variable cannot be null.");

            StringVar nameVar = new StringVar()
            {
                Value = variable.Name
            };

            nameVar.ValueChanged += (object sender, EventArgs e) => { if (IsNameValid(nameVar.Value, variable))
                                                                      {
                                                                          variable.Name = nameVar.Value;
                                                                      }
            };

            DataGridViewRow row = new DataGridViewRow()
            {
                Tag = variable
            };

            row.Cells.Add(nameVar.GetGridCell());
            row.Cells.Add(variable.Value.GetGridCell());
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = VariableTypeHelper.FriendlyName(variable.Value.VariableType)
            });
            row.Cells.Add(new DataGridViewButtonCell()
            {
                Value = "X"
            });
            row.Cells.Add(new DataGridViewButtonCell()
            {
                Value = ">"
            });

            settingsView.table.Rows.Add(row);
        }
Esempio n. 14
0
        /// <inheritdoc />
        public void ShowSettings(DataGridViewRowCollection rows)
        {
            // title
            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3, Title = Node.Name
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;
            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;
            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;
            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;

            rows.Add(row);

            // variable sockets
            foreach (NodeSocketView nodeSocketView in variableSockets)
            {
                nodeSocketView.IEditSettings.ShowSettings(rows);
            }

            // comment
            if (commentVar == null)
            {
                commentVar = new StringVar()
                {
                    Value = Node.Comment
                };
                commentVar.ValueChanged += (object sender, EventArgs e) => { Node.Comment = commentVar.Value; };
            }

            row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewDisableCheckBoxCell()
            {
                Enabled = false
            });
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = "Comment"
            });
            row.Cells.Add(commentVar.GetGridCell());
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = VariableTypeHelper.FriendlyName(commentVar.VariableType)
            });

            rows.Add(row);
        }
 // Use this for initialization
 public override void Reset()
 {
     storeList = new ConcreteDynamicList();
     tagName   = new ConcreteStringVar();
 }
        /// <inheritdoc />
        public void ShowSettings(DataGridViewRowCollection rows)
        {
            // title
            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3, Title = String.Format("Varible of {0}", VariableTypeHelper.FriendlyName(Variable.VariableType))
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;
            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;
            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;
            row.Cells.Add(new DataGridViewTitleCell()
            {
                LeftColumn = 0, RightColumn = 3
            });
            row.Cells[row.Cells.Count - 1].ReadOnly = true;

            rows.Add(row);

            // name
            if (Variable.NamedVariable != null)
            {
                if (nameVar == null)
                {
                    nameVar = new StringVar()
                    {
                        Value = Variable.NamedVariable.Name
                    };
                }

                row = new DataGridViewRow();

                row.Cells.Add(new DataGridViewDisableCheckBoxCell()
                {
                    Enabled = false
                });
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = "Name"
                });
                row.Cells.Add(nameVar.GetGridCell());
                row.Cells[row.Cells.Count - 1].ReadOnly = true;
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = ""
                });

                rows.Add(row);
            }

            // value
            row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewDisableCheckBoxCell()
            {
                Enabled = false
            });
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = "Value"
            });
            row.Cells.Add(Variable.Value.GetGridCell());
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = VariableTypeHelper.FriendlyName(Variable.VariableType)
            });

            rows.Add(row);

            // comment
            if (commentVar == null)
            {
                commentVar = new StringVar()
                {
                    Value = Variable.Comment
                };
                commentVar.ValueChanged += (object sender, EventArgs e) => { Variable.Comment = commentVar.Value; };
            }

            row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewDisableCheckBoxCell()
            {
                Enabled = false
            });
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = "Comment"
            });
            row.Cells.Add(commentVar.GetGridCell());
            row.Cells.Add(new DataGridViewTextBoxCell()
            {
                Value = VariableTypeHelper.FriendlyName(commentVar.VariableType)
            });

            rows.Add(row);
        }
Esempio n. 17
0
 // Use this for initialization
 public override void Reset()
 {
     power = new ConcreteFloatVar();
     text  = new ConcreteStringVar();
 }
Esempio n. 18
0
 // Use this for initialization
 public override void Reset()
 {
     labelOb = new ConcreteGameObjectVar();
     text    = new ConcreteStringVar();
 }
Esempio n. 19
0
 public void SetValue(StringVar value)
 {
     Value = value.Value;
 }