Esempio n. 1
0
        public void RunTest()
        {
            Info MutantInfo = new Info();

            MutantInfo.URL              = "Test";
            MutantInfo.Username         = "******";
            MutantInfo.Password         = "******";
            MutantInfo.WorkingDirectory = "Test";

            string CurrentDirectory = Directory.GetCurrentDirectory();

            using (StreamWriter file = File.CreateText(CurrentDirectory + @"\.credentials"))
            {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, MutantInfo);
            }

            TestLevelFactory factory = new TestLevelFactory();
            ITestLevel       level   = factory.CreateTestLevel("None");

            MainEngine engine = new MainEngine(level, "deployZip");

            try
            {
                engine.Run();
            }
            catch (Exception)
            {
                Console.WriteLine("Expected ex.");
            }
        }
Esempio n. 2
0
    public void InfoCardOnClick()
    {
        db         = GameObject.Find("database").GetComponent <dbAccess>();
        msg        = GameObject.Find("EngineMain").GetComponent <MainEngine>();
        session_id = GameObject.Find("EventSystem").GetComponent <StartGame>().active_session_id;

        infonumber = db.BasicQuery("SELECT COUNT(id) FROM tbl_Info_Card;");
        infonumber.Read();
        maxNumbers = infonumber.GetInt32(0);

        maxNumbers = checkmaxnumber(maxNumbers, 12);

        int    selectednumber = EventSystem.current.currentSelectedGameObject.GetComponent <value>().no_card;
        string selectedbutton = EventSystem.current.currentSelectedGameObject.name;

        GameObject.Find("CardBackgroundi").GetComponent <RectTransform>().localPosition = new Vector3(posopencard(selectedbutton), -80, 0);

        ArrayList result = db.SingleSelectWhere("tbl_Info_Card", "*", "id", "=", selectednumber.ToString());

        desc          = ((string[])result[0])[1];
        reward        = "$2";
        correctanswer = ((string[])result[0])[2];
        GameObject.Find("Content").GetComponent <Text> ().text = desc;
        GameObject.Find("Reward").GetComponent <Text> ().text  = reward;
        showcard();
    }
Esempio n. 3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            MainEngineConfig config = new MainEngineConfig()
            {
                InputFolder             = txtInputFolder.Text.Trim(),
                OutputFolder            = txtOutputFolder.Text.Trim(),
                ExtractLanguageResource = cbExtractLanguageResource.Checked,
                AutoTranslate           = cbAutoTranslate.Checked,
                AllowModifyXamlFile     = cbAllowModifyXamlFile.Checked,
                Translator      = translator,
                PushLogAction   = pushLog,
                UpdateLogAction = updateLog
            };

            if (config.AutoTranslate)
            {
                List <String> list = new List <string>();
                foreach (ListViewItem lvi in lvLanguages.CheckedItems)
                {
                    list.Add(lvi.Tag.ToString());
                }
                config.TranslateTarget = list.ToArray();
            }

            tabControl1.TabPages.Remove(tabPage1);
            MainEngine engine = new MainEngine(config);

            engine.Start();
        }
Esempio n. 4
0
	civilian_manager followers; //use followers' methods to add and subtract person objects and change emotion

    // Use this for initialization
    void Start()
    {
		singleton = this;
        followersIncreaseTimes = 6;
        yearTimer = 120.0f;
        numberofFollowers = 100;
        powerLeft = 0;
		timeForSacrifice();
        audio = GetComponent<AudioSource>();

        eventCounter = 12;
        eventHasOccurredJan = false;
        eventHasOccurredFeb = false;
        eventHasOccurredMar = false;
        eventHasOccurredApr = false;
        eventHasOccurredMay = false;
        eventHasOccurredJun = false;
        eventHasOccurredJul = false;
        eventHasOccurredAug = false;
        eventHasOccurredSep = false;
        eventHasOccurredOct = false;
        eventHasOccurredNov = false;
        eventHasOccurredDec = false;

		followers = civilianManager.GetComponent<civilian_manager> ();
    }
Esempio n. 5
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     AwakeInitiation();
 }
Esempio n. 6
0
        public void Deploy()
        {
            Artificer.CreateArtifact();

            MainEngine runner = new MainEngine(TestLevel, Artificer.Target);

            runner.Run();
        }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        laserhit = GetComponent<AudioSource> ();

        var meobj = GameObject.Find ("__MainEngine");

        if (meobj)
            mainEngine = meobj.GetComponent<MainEngine> ();
    }
Esempio n. 8
0
        static void Main()
        {
            IReader       renderer = new ConsoleRenderer();
            IInputHandler reader   = new ConsoleReader();
            BaseDB        db       = new BaseDB();

            MainEngine engine = new MainEngine(renderer, reader, db);

            engine.Run();
        }
Esempio n. 9
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
         return;
     }
     Instance = this;
     DontDestroyOnLoad(gameObject);
     ClassManager classManager = new ClassManager();
 }
Esempio n. 10
0
    public void ProblemCardOnClick()
    {
        db         = GameObject.Find("database").GetComponent <dbAccess>();
        msg        = GameObject.Find("EngineMain").GetComponent <MainEngine>();
        session_id = GameObject.Find("EventSystem").GetComponent <StartGame>().active_session_id;

        string selectedbutton = EventSystem.current.currentSelectedGameObject.name;

        GameObject.Find("CardBackgroundP").GetComponent <RectTransform>().localPosition = new Vector3(posopencard(selectedbutton), -80, 0);
        GameObject.Find("CardBackgroundP").GetComponent <Image>().enabled = true;
    }
        private void ExtractLanguageResourceForm_Load(object sender, EventArgs e)
        {
            MainEngineConfig config = new MainEngineConfig()
            {
                InputFolder     = inputFolder,
                OutputFolder    = inputFolder,
                AutoTranslate   = false,
                PushLogAction   = pushLog,
                UpdateLogAction = updateLog,
                OnFinishAction  = onMainEngineFinish
            };
            MainEngine engine = new MainEngine(config);

            engine.Start();
        }
Esempio n. 12
0
        public MainSystemTray()
        {
            InitializeComponent();

            mainEngine   = new MainEngine(this);
            settingsForm = new SettingsForm();

            this.component = new Container();
            // Create the NotifyIcon.
            notifyicon             = new NotifyIcon(component);
            notifyicon.MouseClick += notifyIcon_MouseClick;

            //Setting up the right click menu for the icon
            contextMenu      = new ContextMenu();
            menuItemExit     = new MenuItem();
            menuItemSettings = new MenuItem();
            contextMenu.MenuItems.AddRange(new MenuItem[] { menuItemSettings, menuItemExit });
            menuItemSettings.Index  = 0;
            menuItemSettings.Text   = "Settings";
            menuItemSettings.Click += delegate { ShowSettings(); };
            menuItemExit.Index      = 1;
            menuItemExit.Text       = "Exit";
            menuItemExit.Click     += menuItem1_Click;
            notifyicon.ContextMenu  = contextMenu;

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            Icon icon = Properties.Resources.favicon;

            notifyicon.Icon = icon;


            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyicon.Text = "VoxVisio is Running";

            WindowState        = FormWindowState.Minimized;
            notifyicon.Visible = true;
            ShowInTaskbar      = false;
            Hide();

            //this.Resize += frmMain_Resize;
        }
Esempio n. 13
0
        public MainSystemTray()
        {
            InitializeComponent();

            mainEngine = new MainEngine(this);
            settingsForm = new SettingsForm();

            this.component = new Container();
            // Create the NotifyIcon.
            notifyicon = new NotifyIcon(component);
            notifyicon.MouseClick += notifyIcon_MouseClick;

            //Setting up the right click menu for the icon
            contextMenu = new ContextMenu();
            menuItemExit = new MenuItem();
            menuItemSettings = new MenuItem();
            contextMenu.MenuItems.AddRange(new MenuItem[] { menuItemSettings, menuItemExit });
            menuItemSettings.Index = 0;
            menuItemSettings.Text = "Settings";
            menuItemSettings.Click += delegate { ShowSettings(); };
            menuItemExit.Index = 1;
            menuItemExit.Text = "Exit";
            menuItemExit.Click += menuItem1_Click;
            notifyicon.ContextMenu = contextMenu;

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            Icon icon = Properties.Resources.favicon;
            notifyicon.Icon = icon;

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyicon.Text = "VoxVisio is Running";

            WindowState = FormWindowState.Minimized;
            notifyicon.Visible = true;
            ShowInTaskbar = false;
            Hide();

            //this.Resize += frmMain_Resize;
        }
Esempio n. 14
0
        private async Task NewSimulation()
        {
            SimOpt.SimOpts ??= new SimOptions();

            var optionsForm = new OptionsForm()
            {
                Owner = _dialogService.Owner
            };
            await optionsForm.ViewModel.LoadFromOptions(SimOpt.SimOpts);

            var result = optionsForm.ShowDialog();

            if (result != true)
            {
                return;
            }

            optionsForm.ViewModel.SaveToOptions(SimOpt.SimOpts);

            SimOpt.SimOpts.TotRunCycle = -1;

            foreach (var s in SimOpt.SimOpts.Specie)
            {
                s.SubSpeciesCounter = 0;
                s.Native            = true;
            }

            if (_engine != null)
            {
                _engine.UpdateAvailable -= OnUpdateAvailable;
            }

            _engine = new MainEngine();
            _engine.UpdateAvailable += OnUpdateAvailable;

            _engine.StartSimulation();
        }
Esempio n. 15
0
        // Initialize program
        public MainWindow()
        {
            InitializeComponent();

            // Add render event to be used by physics engine
            CompositionTarget.Rendering += RenderGraphics;

            KeyDown += HandleKeyPress;

            // Add custom toolbar controls
            optionBarControls[OptionBarTypes.ParticleControl] = new OptionBarControls.ParticleControl();

            optionBarControls[OptionBarTypes.RigidBodyControl] = new OptionBarControls.RigidBodyControl();

            OptionBarControls.LinearForceControl linearForceControl = new OptionBarControls.LinearForceControl();
            linearForceControl.AddForceButton.Click += (s, e) => { SpawnLinearForce(); };
            optionBarControls[OptionBarTypes.LinearForceControl] = linearForceControl;

            // Initialize physics engine
            simEngine = new MainEngine(SimGrid, ConsoleTextBox);

            // Select default tool
            SelectTool(ParticleToolButton);
        }
Esempio n. 16
0
        protected override void Initialize()
        {
            eng = new MainEngine(this);

            eng.Settings.onWindowedChanged       += SwitchDisplayMode;
            eng.Settings.onVertexLightingChanged += UpdateEffects;
            eng.Settings.onAntiAliasChanged      += UpdateAntiAlias;
            eng.Settings.onVerticalSyncChanged   += UpdateVSync;

            graphics.GraphicsProfile = GraphicsProfile.HiDef;
            UpdateAntiAlias();
            UpdateVSync();
            graphics.ApplyChanges();

            IsMouseVisible = false;

            spriteBatch = new SpriteBatch(GraphicsDevice);

            UpdateEffects();

            for (PlayerIndex i = PlayerIndex.One; i <= PlayerIndex.Four; i++)
            {
                if (GamePad.GetState(i).IsConnected)
                {
                    activeGamePad = i;
                    break;
                }
            }

            Samplers.Refresh();
            Samplers.InitRasterizers();

            SwitchDisplayMode();

            base.Initialize();
        }
Esempio n. 17
0
        public static void Run(bool allocConsole, bool focusWindow, TimeSpan waitTime)
        {
            if (!_enable)
            {
                return;
            }

            System.Threading.Thread.Sleep(waitTime);

            try
            {
                if (allocConsole && IntPtr.Zero == GetConsoleWindow())
                {
                    var hForeground = GetForegroundWindow();
                    var hActiveHwnd = GetActiveWindow();
                    var hFocusHwnd  = GetFocus();

                    AllocConsole();
                    SetConsoleTitle("Unity Console");
                    SetConsoleCP(65001);
                    SetConsoleOutputCP(65001);

                    // reset focus
                    if (!focusWindow)
                    {
                        if (hForeground != IntPtr.Zero)
                        {
                            SetForegroundWindow(hForeground);
                        }
                        if (hActiveHwnd != IntPtr.Zero)
                        {
                            SetActiveWindow(hActiveHwnd);
                        }
                        if (hFocusHwnd != IntPtr.Zero)
                        {
                            SetFocus(hFocusHwnd);
                        }
                    }
                }
            }
            catch
            {
            }

            var oldInStream    = System.Console.In;
            var oldOutStream   = System.Console.Out;
            var oldErrorStream = System.Console.Error;

            try
            {
                if (Environment.GetEnvironmentVariable("TERM") == null)
                {
                    Environment.SetEnvironmentVariable("TERM", "dumb");
                }

                if (allocConsole)
                {
                    if (inStream == null)
                    {
                        inStream = new InternalStream(StandardHandles.STD_INPUT);
                    }
                    outStream = new InternalStream(StandardHandles.STD_OUTPUT);
                    errStream = new InternalStream(StandardHandles.STD_ERROR);

                    oldInStream    = System.Console.In;
                    oldOutStream   = System.Console.Out;
                    oldErrorStream = System.Console.Error;

                    System.Console.SetIn(new StreamReader(inStream));
                    System.Console.SetOut(new StreamWriter(outStream)
                    {
                        AutoFlush = true
                    });
                    System.Console.SetError(new StreamWriter(errStream)
                    {
                        AutoFlush = true
                    });
                }

                var stdwriter = new StreamWriter(new InternalStream(StandardHandles.STD_OUTPUT))
                {
                    AutoFlush = true
                };


                if (MainRuntime == null)
                {
                    var runtimeoptions = new Dictionary <string, object>
                    {
                        ["PrivateBinding"] = true,
                        ["Debug"]          = false,
                        //["Frames"] = false, ["Tracing"] = false,
                    };

                    MainRuntime = Python.CreateRuntime(runtimeoptions);
                    MainEngine  = MainRuntime.GetEngine("py");

                    var scriptfolders = new List <string>();
                    var sb            = new StringBuilder(4096);
                    sb.Length   = 0;
                    sb.Capacity = 4096;
                    if (0 < GetPrivateProfileString("Console", "ScriptsFolders", ".", sb, sb.Capacity, _iniPath))
                    {
                        foreach (var scname in sb.ToString()
                                 .Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                        {
                            var scpath = Path.GetFullPath(Path.IsPathRooted(scname)
                                ? scname
                                : Path.Combine(_rootPath, scname));
                            scriptfolders.Add(scpath);
                        }
                    }
                    if (scriptfolders.Count == 0)
                    {
                        scriptfolders.Add(Path.GetFullPath(_rootPath));
                    }
                    MainEngine.SetSearchPaths(scriptfolders.ToArray());

                    string[] lines;
                    if (GetPrivateProfileSection("Preload.Assemblies", _iniPath, out lines))
                    {
                        foreach (var line in lines)
                        {
                            var asmname = line.Trim();
                            if (string.IsNullOrEmpty(asmname) || asmname.StartsWith(";") || asmname.StartsWith("#"))
                            {
                                continue;
                            }
                            Assembly.Load(new AssemblyName(Path.GetFullPath(Path.Combine(_rootPath, asmname))));
                        }
                    }
                    if (GetPrivateProfileSection("Script.Assemblies", _iniPath, out lines))
                    {
                        foreach (var line in lines)
                        {
                            var asmname = line.Trim();
                            if (string.IsNullOrEmpty(asmname) || asmname.StartsWith(";") || asmname.StartsWith("#"))
                            {
                                continue;
                            }

                            Assembly asm;
                            if (!FindAssembly(asmname, out asm))
                            {
                                stdwriter.WriteLine("Error adding assembly: " + asmname);
                            }
                            else
                            {
                                MainRuntime.LoadAssembly(asm);
                            }
                        }
                    }

                    if (GetPrivateProfileSection("Startup.Script.Py", _iniPath, out lines) && lines != null &&
                        lines.Length > 0)
                    {
                        var str    = string.Join("\n", lines);
                        var source = MainEngine.CreateScriptSourceFromString(str, SourceCodeKind.File);
                        source.Compile().Execute();
                    }
                }
                if (allocConsole && MainEngine != null)
                {
                    var cmdline = new PythonCommandLine();
                    console = new UnityConsole(cmdline);
                    var options = new PythonConsoleOptions
                    {
                        PrintUsage                 = false,
                        PrintVersion               = false,
                        ColorfulConsole            = true,
                        IsMta                      = false,
                        Introspection              = false,
                        TabCompletion              = true,
                        AutoIndentSize             = 2,
                        AutoIndent                 = true,
                        HandleExceptions           = true,
                        IgnoreEnvironmentVariables = true,
                    };
                    cmdline.Run(MainEngine, console, options);
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception: " + ex.ToString());
                System.Threading.Thread.Sleep(10000);
            }

            console = null;
            System.Console.SetIn(oldInStream);
            System.Console.SetOut(oldOutStream);
            System.Console.SetError(oldErrorStream);

            if (allocConsole)
            {
                Close();
            }

            _enable = false; // TODO: something goes wrong with console after shutdown and restart
        }
Esempio n. 18
0
        //DONE

        //Show the students within the system
        private static void ListStudents()
        {
            MainEngine.PrintUserList(new StudentManager().StudentList.Cast <User>().ToList(), "--- List students ---", "<no students>");
        }
Esempio n. 19
0
    void Update()
    {
        if(engine == null)
        {
            GameObject engineObj = GameObject.Find("__MainEngine");
            if(engineObj != null)
            {
                engine = engineObj.GetComponent<MainEngine>();
            }
        }
        else
        {
            device = engine.UsedDevice();
        }
        phoneTransform.rotation = gyroAttitude;
        phoneTransform.Rotate( 0f, 0f, 180f, Space.Self ); // Swap "handedness" of quaternion from gyro.

        if(device == MainEngine.Device.Android)
            phoneTransform.Rotate( 90f, 245f + calibrationValue, 0f, Space.World ); // Rotate to make sense as a camera pointing out the back of your device.

        else if(device == MainEngine.Device.iPhone)
            phoneTransform.Rotate( 90f, 180f + calibrationValue, 0f, Space.World ); // Rotate to make sense as a camera pointing out the back of your device.

        appliedGyroYAngle = transform.eulerAngles.y;
        phoneTransform.Rotate( 0f, -calibrationYAngle, 0f, Space.World ); // Rotates y angle back however much it deviated when calibrationYAngle was saved.

        realRotation = getSmoothRotation(lightSaberTransform.rotation);

        if(hand != null)
        {
            hand.rotation = realRotation;
            hand.Rotate(new Vector3(180.0f, 0.0f, 0.0f), Space.Self);
        }

        if(!listening)
        {
            StartListening();
        }
    }
Esempio n. 20
0
        //DONE

        //Show the list of rooms within the system
        private static void ShowListRooms()
        {
            MainEngine.PrintRoomList(new RoomManager().RoomList, "---List rooms---", "<no rooms>");
        }
Esempio n. 21
0
        //DONE

        //Show staff availible (open slot they own) on a given day
        private static void StaffAvailability()
        {
            MainEngine.CheckStaffAvailability();
        }
Esempio n. 22
0
 void Start()
 {
     S = this;
     GameObject.Find("Canvas/CurrentRound").GetComponent <TextMeshProUGUI>().SetText("Round: " + (currentRound + 1));
 }
Esempio n. 23
0
        //DONE

        //Show the list of slots within the system
        private static void ShowListSlots()
        {
            MainEngine.PrintSlotList(new SlotManager().SlotList, "---List slots---", "<no slots>");
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            var game = new MainEngine();

            game.DisplayMenu();
        }
Esempio n. 25
0
 //Show the staff within the system
 private static void ListStaff()
 {
     MainEngine.PrintUserList(new StaffManager().StaffList.Cast <User>().ToList(), "--- List staff ---", "<no staff>");
 }
Esempio n. 26
0
 //Show Room availibility on a given day
 private static void RoomAvailability()
 {
     MainEngine.CheckRoomAvailability();
 }