Beispiel #1
0
        // [TODO] Temporary. The click event listener for list canvas.
        void OnClickedElementInList(float y)
        {
            if (y > 0 && y < SymbolList.Height)
            {
                // [TODO] This is temporary to assign value, will promote it soon.
                int index = (int)(y + _scrollPosition.y) / 50;
                Alphabet.RevokeAllSelected();
                switch (_currentTab)
                {
                case AlphabetWindowTab.Nodes:
                    if (index < Alphabet.Nodes.Count)
                    {
                        Alphabet.Nodes[index].Selected = true;
                        UpdateFields(Alphabet.Nodes[index]);
                    }
                    else
                    {
                        // Initial the fields.
                        InitFields();
                    }
                    break;

                case AlphabetWindowTab.Connections:
                    if (index < Alphabet.Connections.Count)
                    {
                        Alphabet.Connections[index].Selected = true;
                        UpdateFields(Alphabet.Connections[index]);
                    }
                    else
                    {
                        // Initial the fields.
                        InitFields();
                    }
                    break;
                }
                // Switch to the normal mode.
                _editingMode = EditingMode.None;
            }
        }
Beispiel #2
0
 // private static Regex _ruleOfConnectionAbbreviation = new Regex(@"^[a-z]{1,4}$");
 void ConnectionFieldValidation()
 {
     if (_symbolName == string.Empty ||
         _symbolDescription == string.Empty)
     {
         _messageHint = Languages.GetText("MissionAlphabet-MessageHint-FillColumns");
         _messageType = MessageType.Warning;
     }
     else if (!_ruleOfConnectionName.IsMatch(_symbolName))
     {
         _messageHint = Languages.GetText("MissionAlphabet-MessageHint-NameFieldError");
         _messageType = MessageType.Error;
     }
     else if (Alphabet.IsConnectionNameUsed(_connection))
     {
         _messageHint = Languages.GetText("MissionAlphabet-MessageHint-UsedConnectionName");
         _messageType = MessageType.Error;
     }
     else
     {
         _messageHint = Languages.GetText("MissionAlphabet-MessageHint-DataChanged");
         _messageType = MessageType.Info;
     }
 }
Beispiel #3
0
 // No 9. OverflowedAnyNode.
 private static bool ValidateOverflowedAnyNode(MissionRule rule, GraphGrammar graphGrammar)
 {
     // Sort nodes in ordering.
     GraphGrammarNode[] sourceNodes = rule.SourceRule.Nodes.OrderBy(n => n.Ordering).ToArray();
     // if replaceRule have any node that dont match the source ordering.
     return(!rule.ReplacementRule.Nodes.Exists(n => (Alphabet.IsAnyNode(n.AlphabetID) &&
                                                     (n.Ordering > sourceNodes.Length ? true : !Alphabet.IsAnyNode(sourceNodes[n.Ordering - 1].AlphabetID)))));
 }