コード例 #1
0
        public Argument CreateArgumentWithoutFunctions(Game.Game game, Dictionary <string, string> dictVariables)
        {
            if (this is Function function)
            {
                var worldConstant = function.GetWorldConstant(game.World, dictVariables);
                var worldObject   = game.WorldObjects.Find(obj => obj.Consts.Contains(worldConstant));
                if (worldObject.Tags != null)
                {
                    worldObject.Consts.Add(worldConstant);
                }
                game.AddTemporaryWorldObject(worldObject);

                return(new Constant(worldConstant, worldConstant));
            }
            else
            {
                return(this);
            }
        }
コード例 #2
0
        private Dictionary <string, string> SetResultVariableConstValue(EValidationResult result, Dictionary <string, string> dictVariables, Game.Game game)
        {
            Dictionary <string, string> newDictionary = new Dictionary <string, string>();

            var keyValue = new KeyValuePair <string, string>();

            if (result == EValidationResult.True)
            {
                keyValue = _validConstPair;
            }
            else
            {
                keyValue = _invalidConstPair;
            }

            foreach (KeyValuePair <string, string> pair in dictVariables)
            {
                newDictionary.Add(pair.Key, pair.Value);
            }

            if (newDictionary.ContainsKey(keyValue.Key))
            {
                newDictionary[keyValue.Key] = keyValue.Value;
            }
            else
            {
                newDictionary.Add(keyValue.Key, keyValue.Value);
            }

            if (keyValue.Value.StartsWith("n"))
            {
                var worldConstant = keyValue.Value;
                var worldObject   = game.WorldObjects.Find(obj => obj.Consts.Contains(worldConstant));
                if (worldObject.Tags != null)
                {
                    worldObject.Consts.Add(worldConstant);
                }
                game.AddTemporaryWorldObject(worldObject);
            }

            return(newDictionary);
        }