Beispiel #1
0
        private void Awake()
        {
            global::Tweaker.Core.LogManager.Set(new LogManager());
            logger = global::Tweaker.Core.LogManager.GetCurrentClassLogger();
            logger.Info("Logger initialized");
            tweaker = new Tweaker();
            Scanner     scanner     = new Scanner();
            ScanOptions scanOptions = new ScanOptions();

            scanOptions.Assemblies.ScannableRefs = new Assembly[1] {
                typeof(TweakerConsoleTestbed).Assembly
            };
            TweakerOptions tweakerOptions = new TweakerOptions();

            tweakerOptions.Flags = TweakerOptionFlags.ScanForInvokables | TweakerOptionFlags.ScanForTweakables | TweakerOptionFlags.ScanForWatchables | TweakerOptionFlags.DoNotAutoScan | TweakerOptionFlags.IncludeTests;
            tweaker.Init(tweakerOptions, scanner);
            TweakerSerializer serializer = new TweakerSerializer(tweaker.Scanner);

            tweaker.Scanner.Scan(scanOptions);
            console = Object.Instantiate(ConsolePrefab);
            logger.Info("console instatiated: " + console);
            console.GetComponent <RectTransform>().SetParent(GetComponent <RectTransform>(), worldPositionStays: false);
            logger.Info("console parented to testbed canvas");
            console.Init(tweaker, serializer);
        }
 public void Init(Tweaker tweaker, ITweakerSerializer serializer)
 {
     logger.Info("Init: " + tweaker);
     Tweaker    = tweaker;
     Serializer = serializer;
     Tweaker.Scanner.ScanInstance(GridController);
     GridController.Init();
     Refresh();
     keyBindingManager = base.gameObject.transform.parent.gameObject.AddComponent <KeyBindingManager>();
     keyBindingManager.Init(Tweaker.Invokables.GetInvokables().Values.ToArray());
     CoroutineRunner.StartPersistent(checkShouldActivate(), this, "checkShouldActivate");
 }