public IEnumerator ChangeStageLoad(StageType stageType) { AsyncOperation asyncOperationLoad = SceneManager.LoadSceneAsync(stageType.ToString()); asyncOperationLoad.allowSceneActivation = false; while (!asyncOperationLoad.isDone) { yield return(new WaitForSeconds(0.5f)); if (asyncOperationLoad.progress >= 0.9f) { asyncOperationLoad.allowSceneActivation = true; } } AsyncOperation asyncOperationMain = SceneManager.LoadSceneAsync(StageType.BoardScene.ToString()); asyncOperationMain.allowSceneActivation = false; while (!asyncOperationMain.isDone) { yield return(new WaitForSeconds(0.5f)); if (asyncOperationMain.progress >= 0.9f) { asyncOperationMain.allowSceneActivation = true; } } Debug.Log("boardScene진입하는 ChangeState(StageType.BoardScene);"); ChangeState(StageType.BoardScene); }
void CPU_OnStageDone(StageType type) { //Console.WriteLine("Inside on stage done for: " + args.stageType.ToString()); // if all threads are done (use bools) switch (type) { case StageType.Fetch: fetchDone = true; break; case StageType.Decode: decodeDone = true; break; case StageType.Execute: executeDone = true; break; case StageType.Store: storeDone = true; break; } lock (allStagesDoneLock) { if (fetchDone && decodeDone && executeDone && storeDone) { Console.WriteLine("called stage done event, " + type.ToString() + " was the last to finish."); OnStageDone(this, new StageDoneEventArgs()); } } }
// Use this for initialization void Start() { TimeSta = GameObject.Find("TimeStage").GetComponent <TimeStage>(); bebar = GameObject.Find("Bebar").GetComponent <BebarBoss>(); player = GameObject.Find("Player"); P_Sta = player.GetComponent <PlayerStatus>(); A_screen = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>(); nav = GetComponent <NavMeshAgent>(); if (BossStage.ToString() == "Stage_1") { bossExp = 80; } else if (BossStage.ToString() == "Stage_2") { bossExp = 200; } else if (BossStage.ToString() == "Stage_3") { bossExp = 400; } itemAd = new int[] { 4, 10, 16 }; itemAd2 = new int[] { 4, 10, 16, 22, 28, 34 }; itemAd3 = new int[] { 22, 28, 34 }; }
public IEnumerator ChangeStage(StageType stageType) { AsyncOperation loadOperation = SceneManager.LoadSceneAsync(stageType.ToString()); loadOperation.allowSceneActivation = false; while (!loadOperation.isDone) { yield return(new WaitForSeconds(0.5f)); if (loadOperation.progress >= 0.9f) { loadOperation.allowSceneActivation = true; } } }
/// <summary> /// Runs the Powershell Script Engine. /// </summary> /// <param name="options">The options parameters.</param> /// <returns>Exit code</returns> public int Run(string[] options) { Console.OutputEncoding = Encoding.ASCII; FileVersionInfo fvi = GetFileVersionInfo(); try { NetworkCredential credential = null; int version = 2; string domain = null; string userName = null; SecureString password = null; string script = null; bool isElevated = false; int schedule = -1; bool passthrough = false; bool hash = false; bool nologo = false; StageType stage = StageType.None; // Gets CLI arguments. for (int i = 0; i < options.Length; i++) { string arg = options[i]; if (arg.StartsWith("-")) { switch (arg.ToLowerInvariant()) { case "-hash": password = GetArgumentValue(options, ref i).ConvertToSecureString(); hash = true; break; case "-script": script = GetArgumentValue(options, ref i); break; case "-version": version = Convert.ToInt32(GetArgumentValue(options, ref i)); break; case "-domain": domain = StringCipher.Decrypt(GetArgumentValue(options, ref i), GetUniqueIdentifier()); break; case "-username": userName = StringCipher.Decrypt(GetArgumentValue(options, ref i), GetUniqueIdentifier()); break; case "-password": password = StringCipher.Decrypt(GetArgumentValue(options, ref i), GetUniqueIdentifier()).ConvertToSecureString(); break; case "-elevated": isElevated = true; break; case "-schedule": double s = Convert.ToDouble(GetArgumentValue(options, ref i), CultureInfo.InvariantCulture) * 60 * 1000; if (s > Int32.MaxValue) { schedule = Int32.MaxValue; } else if (s == 0) { schedule = 500; } else { schedule = (int)s; } break; case "-pid": _processId = Convert.ToInt32(GetArgumentValue(options, ref i)); passthrough = true; break; case "-stage": stage = (StageType)Enum.Parse(typeof(StageType), GetArgumentValue(options, ref i)); break; case "-silent": _silent = true; break; case "-debug": _debug = true; break; case "-nologo": nologo = true; break; case "-help": PrintHeader(); PrintNotice(); return(0); default: PrintHeader(); Console.WriteLine("Wrong argument: {0}", arg); PrintWarning(); return(EXITCODE_KO); } } } Log("START " + fvi.ProductName.ToUpperInvariant() + " v" + fvi.FileVersion + " WITH PID #" + Process.GetCurrentProcess().Id); Log("ARGS : " + string.Join(" ", options)); // Script parameters is requiered ! if (string.IsNullOrEmpty(script) && !passthrough && !hash) { PrintHeader(); Console.WriteLine("Script parameter is required !"); PrintWarning(); return(EXITCODE_KO); } // Show Copyright banner. if (!nologo) { PrintHeader(); } // Hash password. if (hash) { // Get system UID string k = StringCipher.Encrypt(password.ConvertToUnsecureString(), GetUniqueIdentifier()); Console.WriteLine(k); return(EXITCODE_OK); } // Gets user credentials if (!string.IsNullOrEmpty(userName)) { // WTF! .Net 3.5 does not implements the creation of ICredentials with a SecureString. MS are you serious ? if (!string.IsNullOrEmpty(domain)) { credential = new NetworkCredential(userName, password.ConvertToUnsecureString(), domain); } else { credential = new NetworkCredential(userName, password.ConvertToUnsecureString()); } } // Check if the current process already runs with elevated privileges WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); if (isElevated) { if (UAC.IsProcessElevated) { // removes elevated mode options = GetFilteredParameters(options, new[] { "-elevated" }, null).ToArray(); isElevated = false; Log("UAC : Elevation not needed"); } else { Log("UAC : Need elevation"); } } // Encode pipeline for use in PS if any. if (IsPipedInput() && !passthrough) { string pipe = Console.In.ReadToEnd(); if (!string.IsNullOrEmpty(pipe)) { Log("READ PIPE :\n" + pipe); StringBuilder s = new StringBuilder(); s.AppendFormat("\"{0}\"", Convert.ToBase64String(Encoding.Unicode.GetBytes(pipe))); s.Append("|%{[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($_))}|" + script); script = s.ToString(); } } // Stage Logic if (stage == StageType.None) { if (!string.IsNullOrEmpty(userName)) { stage = StageType.Credential; } else if (isElevated) { stage = StageType.Elevated; } else { stage = StageType.PowerShell; } } // Starts named pipes server for communication with the child process NamedPipeServer <String> server = null; if (stage != StageType.PowerShell) { if (!passthrough) { server = GetNamePipeServer(script, _processId); server.Start(); } } // Starts the child processes loop. do { try { Log("STAGE : " + ((int)stage).ToString() + " - " + stage.ToString()); Log("PASSTHRU : " + passthrough.ToString()); switch (stage) { case StageType.Credential: { // Construct child process arguments string[] switchParamToRemoves = { "-help" }; string[] keyPairParamToRemoves = { "-domain", "-username", "-password", "-script", "-schedule", "-stage" }; List <string> param = GetFilteredParameters(options, switchParamToRemoves, keyPairParamToRemoves); // Add PID identifier for named pipe communication if (!passthrough) { param.Add("-pid"); param.Add(_processId.ToString()); } Log("ARGS CHILD : " + string.Join(" ", param.ToArray())); // Starts child process of myself with credentials: .Net Process class failed to start a process with custom credentials when running under LocalSystem account. if (WindowsIdentity.GetCurrent().Name.ToLowerInvariant() == "nt authority\\system") { RunSelfProcessInLocalSystem(param, credential); } else { RunSelfProcess(param, false, credential); } Thread.Sleep(1000); break; } case StageType.Elevated: { // Construct child process arguments string[] switchParamToRemoves = { "-elevated", "-help" }; string[] keyPairParamToRemoves = { "-script", "-schedule", "-stage" }; List <string> param = GetFilteredParameters(options, switchParamToRemoves, keyPairParamToRemoves); // Add PID identifier if (!passthrough) { param.Add("-pid"); param.Add(_processId.ToString()); } Log("ARGS CHILD : " + string.Join(" ", param.ToArray())); // Starts child process of myself with elevated privileges RunSelfProcess(param, isElevated, credential); Thread.Sleep(1000); break; } case StageType.PowerShell: { // Starts named pipes client for communication with the parent process. NamedPipeClient <String> client = null; if (passthrough) { client = GetNamedPipeClientAndWaitForConnection(_processId, out script); } // Runs the PS process //WindowsStationAndDesktop.GrantAccess(credential.UserName); using (new PrivilegeEnabler(Process.GetCurrentProcess(), Privilege.AssignPrimaryToken, Privilege.IncreaseQuota, Privilege.TrustedComputerBase)) using (ScriptRunner ps = new ScriptRunner(ScriptEngine.Language.PowerShell, credential, isElevated, script)) { ps.OutputReceived += (o, e) => { if (passthrough) { client.PushMessage(e.Data); } else { Console.WriteLine(e.Data); } Log("PS : " + e.Data); }; ps.ProcessExited += (o, e) => { ExitCode = e.ExitCode; if (passthrough) { client.PushMessage(NAMEDPIPES_EXITCODE + e.ExitCode); } }; ps.Run(new[] { "-V", version.ToString() }); } Thread.Sleep(1000); if (passthrough) { client.Stop(); } break; } } } catch (Exception ex) { if (!_silent) { Console.WriteLine("ERROR: {0}", ex.ToString().Replace(Environment.NewLine, " ")); } Log("ERROR : " + ex.ToString()); } // Wait the schedule time if (schedule != -1) { Thread.Sleep(schedule); } } while (schedule != -1); // Stops the pipe server if (server != null && !passthrough) { server.Stop(); } } catch (Exception ex) { if (!_silent) { Console.WriteLine("ERROR: {0}", ex.ToString().Replace(Environment.NewLine, " ")); } Log("ERROR : " + ex.ToString()); } Log("EXIT CODE : " + ExitCode); Log("STOP " + fvi.ProductName.ToUpperInvariant() + " v" + fvi.FileVersion + " WITH PID #" + Process.GetCurrentProcess().Id); return(ExitCode); }