예제 #1
0
        static void Main(string[] args)
        {
            string line, archivo, input, estructura;

            while (true)
            {
                line       = null;
                archivo    = null;
                input      = null;
                estructura = null;
                Console.WriteLine("Escriba la estructura a continuación y al finalizar escriba end." + System.Environment.NewLine +
                                  "Si quiere importar desde un archivo guardelo en la misma carpeta del trabajo" + System.Environment.NewLine +
                                  "y escriba por consola \"importar nombrearchivo.txt\"");
                while ((line = Console.ReadLine()) != "end")
                {
                    if (line.Contains("importar"))
                    {
                        archivo = line.Replace("importar", "").Trim();
                        break;
                    }
                    estructura += line + System.Environment.NewLine;
                }
                if (archivo != null)
                {
                    if (File.Exists(archivo))
                    {
                        input = File.ReadAllText(archivo);
                    }
                }
                else
                {
                    input = estructura;
                }
                if (input != null)
                {
                    Console.WriteLine("Generando el JSON...");
                    try
                    {
                        Lexer lexer        = new Lexer();
                        var   resultTokens = lexer.Tokenize(input);

                        GoParser parser = new GoParser();

                        GoInstance instance = parser.SetAndValidateInput(resultTokens);

                        object jsonResult = instance.GetRandomMainObject();
                        Console.WriteLine(jsonResult.ToString());
                    }catch (Exception ex)
                    {
                        Console.WriteLine("ERROR AL GENERAR EL JSON:" +
                                          System.Environment.NewLine + ex.Message +
                                          System.Environment.NewLine);
                    }
                }
                else
                {
                    Console.WriteLine("Error al procesar el input.");
                }
            }
        }
예제 #2
0
    /// <summary>
    /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens
    /// </summary>
    public void addTween(AbstractGoTween tween)
    {
        if (_instance == null)
        {
            _instance = this;
        }


        // early out for invalid items
        if (!tween.isValid())
        {
            return;
        }

        // dont add the same tween twice
        if (_tweens.Contains(tween))
        {
            return;
        }

        // check for dupes and handle them before adding the tween. we only need to check for Tweens
        if (duplicatePropertyRule != GoDuplicatePropertyRuleType.None && tween is GoTween)
        {
            // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween
            if (handleDuplicatePropertiesInTween(tween as GoTween))
            {
                return;
            }

            // if we became invalid after handling dupes dont add the tween
            if (!tween.isValid())
            {
                return;
            }
        }

        _tweens.Add(tween);

        // enable ourself if we are not enabled
        if (!_instance.enabled) // purposely using the static instace property just once for initialization
        {
            _instance.enabled = true;
        }

        // if the Tween isn't paused and it is a "from" tween jump directly to the start position
        if (tween is GoTween && ((GoTween)tween).isFrom && tween.state != GoTweenState.Paused)
        {
            tween.update(0);
        }

        // should we start up the time scale independent update?
        if (!_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == GoUpdateType.TimeScaleIndependentUpdate)
        {
            _instance.StartCoroutine(_instance.timeScaleIndependentUpdate());
        }

        #if UNITY_EDITOR
//        _instance.gameObject.name = string.Format("GoKit ({0} tweens)", _tweens.Count);
        #endif
    }
예제 #3
0
 static public int get_logLevel(IntPtr l)
 {
     try {
         GoInstance self = (GoInstance)checkSelf(l);
         pushEnum(l, (int)self.logLevel);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #4
0
 static public int get_duplicatePropertyRule(IntPtr l)
 {
     try {
         GoInstance self = (GoInstance)checkSelf(l);
         pushEnum(l, (int)self.duplicatePropertyRule);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #5
0
 static public int get_defaultUpdateType(IntPtr l)
 {
     try {
         GoInstance self = (GoInstance)checkSelf(l);
         pushEnum(l, (int)self.defaultUpdateType);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #6
0
 static public int get_validateTargetObjectsEachTick(IntPtr l)
 {
     try {
         GoInstance self = (GoInstance)checkSelf(l);
         pushValue(l, self.validateTargetObjectsEachTick);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #7
0
 static public int set_duplicatePropertyRule(IntPtr l)
 {
     try {
         GoInstance self = (GoInstance)checkSelf(l);
         GoDuplicatePropertyRuleType v;
         checkEnum(l, 2, out v);
         self.duplicatePropertyRule = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #8
0
 static public int set_defaultUpdateType(IntPtr l)
 {
     try {
         GoInstance   self = (GoInstance)checkSelf(l);
         GoUpdateType v;
         checkEnum(l, 2, out v);
         self.defaultUpdateType = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #9
0
 static public int killAllTweensWithTarget(IntPtr l)
 {
     try {
         GoInstance    self = (GoInstance)checkSelf(l);
         System.Object a1;
         checkType(l, 2, out a1);
         self.killAllTweensWithTarget(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #10
0
 static public int removeTweenWithTag(IntPtr l)
 {
     try {
         GoInstance    self = (GoInstance)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         self.removeTweenWithTag(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #11
0
 static public int set_logLevel(IntPtr l)
 {
     try {
         GoInstance self = (GoInstance)checkSelf(l);
         GoLogLevel v;
         checkEnum(l, 2, out v);
         self.logLevel = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #12
0
 static public int addTween(IntPtr l)
 {
     try {
         GoInstance      self = (GoInstance)checkSelf(l);
         AbstractGoTween a1;
         checkType(l, 2, out a1);
         self.addTween(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #13
0
 static public int set_validateTargetObjectsEachTick(IntPtr l)
 {
     try {
         GoInstance     self = (GoInstance)checkSelf(l);
         System.Boolean v;
         checkType(l, 2, out v);
         self.validateTargetObjectsEachTick = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #14
0
 static public int tweensWithId(IntPtr l)
 {
     try {
         GoInstance   self = (GoInstance)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.tweensWithId(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #15
0
 static public int removeTween(IntPtr l)
 {
     try {
         GoInstance      self = (GoInstance)checkSelf(l);
         AbstractGoTween a1;
         checkType(l, 2, out a1);
         var ret = self.removeTween(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #16
0
 static public int warn(IntPtr l)
 {
     try {
         GoInstance    self = (GoInstance)checkSelf(l);
         System.Object a1;
         checkType(l, 2, out a1);
         System.Object[] a2;
         checkParams(l, 3, out a2);
         self.warn(a1, a2);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #17
0
 static public int tweensWithTarget(IntPtr l)
 {
     try {
         GoInstance    self = (GoInstance)checkSelf(l);
         System.Object a1;
         checkType(l, 2, out a1);
         System.Boolean a2;
         checkType(l, 3, out a2);
         var ret = self.tweensWithTarget(a1, a2);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #18
0
 static public int from(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 4)
         {
             GoInstance    self = (GoInstance)checkSelf(l);
             System.Object a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             GoTweenConfig a3;
             checkType(l, 4, out a3);
             var ret = self.from(a1, a2, a3);
             pushValue(l, ret);
             return(1);
         }
         else if (argc == 5)
         {
             GoInstance    self = (GoInstance)checkSelf(l);
             System.Object a1;
             checkType(l, 2, out a1);
             GoSpline a2;
             checkType(l, 3, out a2);
             System.Single a3;
             checkType(l, 4, out a3);
             GoTweenConfig a4;
             checkType(l, 5, out a4);
             var ret = self.from(a1, a2, a3, a4);
             pushValue(l, ret);
             return(1);
         }
         return(error(l, "No matched override function to call"));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #19
0
 private void OnApplicationQuit()
 {
     _instance = null;
     Destroy(gameObject);
     _applicationIsQuitting = true;
 }
예제 #20
0
 private void Awake()
 {
     _instance = this;
 }
예제 #21
0
 public abstract dynamic GenerateTrashValue(GoInstance goInstance);
예제 #22
0
 public override dynamic GenerateTrashValue(GoInstance goInstance)
 {
     return(goInstance.GetRandomInstanceObject(this.KeyValue));
 }