public EditClass(Controller controller) { InitializeComponent(); Cancel = true; m_controller = controller; }
public LoggingOut(Controller controller) { InitializeComponent(); Controller = controller; StartLoadingAnimation(lblLoadingImage); }
public void launchMissile(MissileType type, GameObject T, Controller.Owner O, float d, float omm, bool hacked) { StopAllCoroutines(); if (hacked) StartCoroutine(enableCollisions()); switch (O) { case Controller.Owner.Enemy: gameObject.layer = LayerMask.NameToLayer("eMissiles"); targetLayer = LayerMask.NameToLayer("Player"); if(PS_Jammer.JammerEnabled) StartCoroutine(checkJammer()); break; case Controller.Owner.Player: gameObject.layer = LayerMask.NameToLayer("pMissiles"); targetLayer = LayerMask.NameToLayer("Enemies"); break; } assignedTarget = true; target = T; missileType = type; Modifier = omm; HP = 10; damage = d; }
/// <inheritDocs/> public void Configure(Control webFormsControl, Controller controller) { var formElementController = (IFormElementController<IFormElementModel>)controller; var sectionControl = (FormSectionHeader)webFormsControl; var sectionElementModel = (ISectionHeaderModel)formElementController.Model; sectionElementModel.Text = sectionControl.Title; }
void Start() { controller = new Controller(); _princessHasShot = false; coolDownValue = 1.0f; currCD = 0.0f; }
public OpeningAccountManagement(Controller controller) { InitializeComponent(); Controller = controller; StartLoadingAnimation(lblLoadingImage); }
// Use this for initialization void Start() { leap = new Controller(); for ( int i = 0; i < FingerObjects.Length; i++ ) { FingerObjects[i].transform.localScale = new Vector3( 10, 10, 10 ); } }
public static void Main() { SDCard sdCard = new SDCard(); //todo: need sdCard mode detection ILogger logger = new PersistenceWriter(new FileStream(@"\SD\telemetry.bin", FileMode.CreateNew), new TelemetryFormatter()); //ILogger logger = new DebugLogger(); // use for debugging //ILogger logger = new NullLogger(); // use for release //Assumes one type of speed controller on quad //ISpeedControllerSettings speedControllerSettings = new HobbyKingSs2530Settings(); //IPWM pwmFront = new SecretLabsPWM(Pins.GPIO_PIN_D9); //SpeedController electricSpeedControllerFront = new SpeedController(speedControllerSettings, pwmFront); //IPWM pwmRear = new SecretLabsPWM(Pins.GPIO_PIN_D8); //SpeedController electricSpeedControllerRear = new SpeedController(speedControllerSettings, pwmRear); //IPWM pwmRight = new SecretLabsPWM(Pins.GPIO_PIN_D8); //SpeedController electricSpeedControllerRight = new SpeedController(speedControllerSettings, pwmRight); //IPWM pwmLeft = new SecretLabsPWM(Pins.GPIO_PIN_D8); //SpeedController electricSpeedControllerLeft = new SpeedController(speedControllerSettings, pwmLeft); MotorMixer mixer = null; PIDSettings[] pidSettings = GetPIDSettings(); AxesController axesController = new AxesController(pidSettings[0], pidSettings[1], pidSettings[2], true); Gyro gyro = new DefaultGyro(new AircraftPrincipalAxes()); Radio radio = new DefaultRadio(null,null); ControllerLoopSettings loopSettings = GetLoopSettings(); Controller controller = new Controller(mixer, axesController, gyro, radio, loopSettings, GetMotorSettings(), logger); }
public void BasicIPC() { using (var sp = new ServiceProvider(true)) using (var p = StartProcess("payloadtest_debug.exe", "0")) using (var c = new Controller(p.Process, sp)) { p.WaitForText("$0"); sp.Scheduler.WaitFor(c.InjectPayload()); sp.Scheduler.WaitFor(c.WaitForPayloadReady()); sp.Scheduler.WaitFor(c.SetLogging(true)); sp.Scheduler.WaitFor(c.SetEnabled("*", true)); p.Write(" "); p.WaitForText("$1"); p.WaitForText("marker hit: 0 'function_with_marker::marker::hit'"); p.Write(" "); p.WaitForText("$2"); p.WaitForText("marker hit: 0 'function_with_marker::marker::hit'"); sp.Scheduler.WaitFor(c.SetEnabled("*", false)); p.Write(" "); p.WaitForText("$3"); p.Write(" "); p.WaitForText("$4"); p.Succeeded(); } }
static void Main(string[] args) { //Create an instance of HTTPWatch Controller Controller control = new Controller(); //Start IE Driver. IE Driver Server is located in C:\\ IWebDriver driver = new InternetExplorerDriver(@"C:\"); // Set a unique initial page title so that HttpWatch can attach to it string uniqueTitle = Guid.NewGuid().ToString(); IJavaScriptExecutor js = driver as IJavaScriptExecutor; js.ExecuteScript("document.title = '" + uniqueTitle + "';"); // Attach HttpWatch to the instance of Internet Explorer created through WebDriver Plugin plugin = control.AttachByTitle(uniqueTitle); //Open the HTTPWatch Window plugin.OpenWindow(false); //Navigate to the BMI Application Page driver.Navigate().GoToUrl("http://dl.dropbox.com/u/55228056/bmicalculator.html"); //Perform some steps driver.FindElement(By.Id("heightCMS")).SendKeys("181"); driver.FindElement(By.Id("weightKg")).SendKeys("80"); driver.FindElement(By.Id("Calculate")).Click(); //Export the HAR Log generated to a file plugin.Log.Save(@"C:\bmicalc.hwl"); //Close the Internet Explorer driver.Close(); }
void Start() { leap_controller_ = new Controller(); num_active_hands_ = 0; hands_ = new List<HandData>(); physics_hands_ = new List<HandData>(); }
bool simulationRunning = false; // whether or not the Business Day simulation is running #endregion Fields #region Constructors // CONSTRUCTOR for the class public TimeController(Controller c, Text lblTime) { // initialise the variables mainController = c; timeLabel = lblTime; BeginDay(); }
public void Test_View_Events_WiredUp() { MockRepository mocks = new MockRepository(); IView view = mocks.StrictMock<IView>(); // expect that the model is set on the view // NOTE: if I move this Expect.Call above // the above Expect.Call, Rhino mocks blows up on with an // "This method has already been set to ArgsEqualExpectation." // not sure why. Its a side issue. Expect.Call(view.Model = Arg<Model>.Is.NotNull); // expect the event ClickButton to be wired up IEventRaiser clickButtonEvent = Expect.Call(delegate { view.ClickButton += null; }).IgnoreArguments().GetEventRaiser(); // Q: How do i set an expectation that checks that the controller // correctly updates the model in the event handler. // i.e. above we know that the controller executes // _model.UserName = "******" // but how can I verify it? // The following wont work, because Model is null: // Expect.Call(view.Model.UserName = Arg<String>.Is.Anything); mocks.ReplayAll(); Controller controller = new Controller(view); clickButtonEvent.Raise(null, null); mocks.VerifyAll(); }
// Use this for initialization void Start () { _Camera = Camera.main; if (_PointerSettings.AutoStart) { _isLeftsAppearing = true; _isRightsAppearing = true; } else { _isLeftsAppearing = false; _isRightsAppearing = false; } gameObject.transform.SetParent (_Camera.transform, false); _controller = new Controller (); pointersObj = new GameObject("Pointers"); pointersObj.transform.SetParent (gameObject.transform, false); leftHandObj = new GameObject ("Left Hand"); leftHandObj.transform.SetParent (pointersObj.transform, false); rightHandObj = new GameObject ("Right Hand"); rightHandObj.transform.SetParent (pointersObj.transform, false); // 포인터의 중복설정을 확인한다. for (int i=0; i<_PointerSettings.PointerUsed.Length-1; i++) { for (int j=i+1; j<_PointerSettings.PointerUsed.Length;j++) { if (_PointerSettings.PointerUsed[i] == _PointerSettings.PointerUsed[j]) { print ("same pointers are detected"); return; } } } // 사용하기로 설정한 포인터타입에만 포인터를 생성한다. foreach (PointerType type in _PointerSettings.PointerUsed) { // 포인터 객체를 만들고 사전에 추가 후 빌드한다. GameObject pointerObj = new GameObject ("Pointer_" + type); if (type == PointerType.LeftThumb || type == PointerType.LeftIndex || type == PointerType.LeftMiddle || type == PointerType.LeftRing || type == PointerType.LeftPinky) { pointerObj.transform.SetParent (leftHandObj.transform, false); } else { pointerObj.transform.SetParent (rightHandObj.transform, false); } _pointerDict.Add (type, pointerObj); InteractionManager.SetPointerPos (type, Vector3.one*9999.0f); Pointer pointer = pointerObj.AddComponent<Pointer> (); pointer.Build (_PointerSettings, type); } }
public void SetUp() { ChangingHeights.Instance.eventDelegate += delegateReference; controller = ChangingHeights.Instance.Controller; shadowProjector.orthographicSize = ChangingHeights.Instance.size; }
public GridViewModel(Controller controller, int totalRecords, string gridBindingAction = "GridData", string singleItemDeleteAction = "Delete") { ControllerHelper = new ControllerHelper(controller); TotalRecords = totalRecords; GridBindingAction = gridBindingAction; SingleItemDeleteAction = singleItemDeleteAction; }
/// <summary> /// Constructs a new MultiClampDevice /// </summary> /// <param name="commander">MultiClampCommander instance</param> /// <param name="c">Symphony Controller instance</param> /// <param name="background">Dictionary of background Measurements for each MultiClamp operating mode</param> public MultiClampDevice(IMultiClampCommander commander, Controller c, IDictionary<MultiClampInterop.OperatingMode, IMeasurement> background) : base("Multiclamp-" + commander.SerialNumber + "-" + commander.Channel, "Molecular Devices", c) { InputParameters = new ConcurrentDictionary<DateTimeOffset, MultiClampParametersChangedArgs>(); OutputParameters = new ConcurrentDictionary<DateTimeOffset, MultiClampParametersChangedArgs>(); Commander = commander; Commander.ParametersChanged += (sender, mdArgs) => { log.DebugFormat("MultiClamp parameters changed. Mode = {0}, External Command Sensistivity Units = {1} Timestamp = {2}", mdArgs.Data.OperatingMode, mdArgs.Data.ExternalCommandSensitivityUnits, mdArgs.TimeStamp); if (HasBoundInputStream) InputParameters[mdArgs.TimeStamp.ToUniversalTime()] = mdArgs; if (HasBoundOutputStream) { OutputParameters[mdArgs.TimeStamp.ToUniversalTime()] = mdArgs; foreach (var outputStream in Streams.Values.OfType<IDAQOutputStream>().Where(s => s.DAQ != null && s.DAQ.Running == false)) { log.DebugFormat("Setting new background for stream {0}", outputStream.Name); outputStream.ApplyBackground(); } } }; Backgrounds = background; }
public void Initialise() { var networkScanner = new NetworkScanner(); for(int i = 0; i < 20; i++) { Thread.Sleep(100); networkScanner.Scan(); foreach (ControllerInfo controller in networkScanner.Controllers) { if (controller.IPAddress.Equals(this.RobotIPAddress)) { this.Controller = ControllerFactory.CreateFrom(controller); this.Controller.Rapid.ExecutionStatusChanged += new EventHandler<ExecutionStatusChangedEventArgs>(RapidExecutionStatusChanged); this.SetSpeed(100); _status = HardwareStatus.Operational; return; } } } _status = HardwareStatus.Offline; throw new Exception(string.Format("Robot at {0} could not be found.", this.RobotIPAddress)); }
void Start() { controller = new Controller (); controller.EnableGesture (Gesture.GestureType.TYPE_SWIPE); controller.EnableGesture (Gesture.GestureType.TYPE_CIRCLE); controller.EnableGesture (Gesture.GestureType.TYPE_SCREEN_TAP); //for swipe controller.Config.SetFloat ("Gesture.Swipe.MinLength", 200.0f); controller.Config.SetFloat ("Gesture.Swipe.MinVelocity", 750f); //for circle controller.Config.SetFloat ("Gesture.Circle.MinRadius", 80.0f); controller.Config.SetFloat ("Gesture.Circle.MinArc", 1.8f); //for screen tap controller.Config.SetFloat ("Gesture.ScreenTap.MinForwardVelocity", 1.0f); controller.Config.SetFloat ("Gesture.ScreenTap.HistorySeconds", .05f); controller.Config.SetFloat ("Gesture.ScreenTap.MinDistance", 1.0f); controller.Config.Save (); timeLimit = 5.0f; timer = 0.0f; p = GameObject.Find ("ps").GetComponent<ParticleSystem> (); before = GameObject.Find ("before").GetComponent<SpriteRenderer> (); after = GameObject.Find ("after").GetComponent<SpriteRenderer> (); after.color = new Color (255, 255, 255, 0); p.Pause (); }
public override void OnFrame(Controller controller) { // Get the most recent frame and report some basic information Frame frame = controller.Frame(); if (!frame.Hands.IsEmpty) { if ((DateTime.Now - checkedTime) > new TimeSpan(0, 0, 0, 0, 500)) { // 500ミリ秒ごとに前回位置との差分を求める // 移動量がしきい値を超えていたらイベントとして認識するする if (this.checkedFrame != null) { Vector diff = frame.Hands[0].Translation(this.checkedFrame); //SafeWriteLine("X移動量: " + diff.x); if (diff.x > 150) { SafeWriteLine("右フリックしました! :" + diff.x); } if (diff.x < -150) { SafeWriteLine("左フリックしました! :" + diff.x); } } this.checkedTime = DateTime.Now; this.checkedFrame = frame; } } }
// Use this for initialization protected virtual void Start() { SetInitialProperties(); characterController = GetComponent<CharacterController>(); control = GetComponent<Controller>(); motor = GetComponent<CharacterMotor>(); }
// Use this for initialization void Start() { controller= new Controller(); _leapManager = GameObject.Find ("LeapManager").GetComponent<LeapManager> (); _leapManager._mainCam = Camera.main; cursor=GameObject.Find("Cursor"); }
/// <summary> /// Retrieve the object from dictionary /// </summary> /// <param name="controller"></param> /// <param name="id"></param> /// <returns></returns> internal Invoicedto Get(object controller, Int64 id) { invoiceController = controller as System.Web.Mvc.Controller; Dictionary<Int64, Invoicedto> invoiceRepo = invoiceController.TempData["Invoice"] as Dictionary<Int64, Invoicedto>; invoiceController.TempData.Keep(); return invoiceRepo[id]; }
public IActionResult InvokeAction(Controller controller, ActionDescriptor actionDescriptor) { /* * Child processes that use such C run-time functions as printf() and fprintf() can behave poorly when redirected. * The C run-time functions maintain separate IO buffers. When redirected, these buffers might not be flushed immediately after each IO call. * As a result, the output to the redirection pipe of a printf() call or the input from a getch() call is not flushed immediately and delays, sometimes-infinite delays occur. * This problem is avoided if the child process flushes the IO buffers after each call to a C run-time IO function. * Only the child process can flush its C run-time IO buffers. A process can flush its C run-time IO buffers by calling the fflush() function. */ var methodWithIntParameter = controller.GetType() .GetMethods() .FirstOrDefault(x => x.Name.ToLower() == actionDescriptor.ActionName.ToLower() && x.GetParameters().Length == 1 && x.GetParameters()[0].ParameterType == typeof(string) && x.ReturnType == typeof(IActionResult)); if (methodWithIntParameter == null) { throw new HttpNotFoundException( string.Format( "Expected method with signature IActionResult {0}(string) in class {1}Controller", actionDescriptor.ActionName, actionDescriptor.ControllerName)); } try { var actionResult = (IActionResult) methodWithIntParameter.Invoke(controller, new object[] { actionDescriptor.Parameter }); return actionResult; } catch (TargetInvocationException ex) { throw ex.InnerException; } }
/// <summary> /// Construct a <code>Settings</code> form with no weapon list /// </summary> /// <param name="uic">Calling UIController</param> /// <param name="configReader">A configuration reader</param> public Settings(Controller.UIController uic, ConfigReader configReader) : this(uic, configReader, new List<string>()) { MessageBox.Show("This is the first time you have run SANTA. Please specify the paths for the report template, database, and log file.", "First run", MessageBoxButtons.OK, MessageBoxIcon.Information); firstRun = true; }
/// <summary> /// Renders the mail message. /// </summary> /// <param name="templateName">Name of the template.</param> /// <param name="engineContext">The engine context.</param> /// <param name="controller">The controller.</param> /// <param name="doNotApplyLayout">if set to <c>true</c> [do not apply layout].</param> /// <returns></returns> public Message RenderMailMessage(string templateName, IRailsEngineContext engineContext, Controller controller, bool doNotApplyLayout) { context.AddMailTemplateRendered(templateName, controller.PropertyBag); return new Message("from", "to", "subject", "body"); }
private static object[] BuildMethodParameters(PluginManifest Manifest, Type Handler, MethodInfo methodInfo, string ActionName, Controller HostController) { var methodParams = methodInfo.GetParameters(); var result = new object[methodParams.Length]; for (int i = 0; i < methodParams.Length; i++) { var methodParam = methodParams[i]; Type parameterType = methodParam.ParameterType; IModelBinder modelBinder = ModelBinders.Binders.GetBinder(parameterType); IValueProvider valueProvider = HostController.ValueProvider; string parameterName = methodParam.Name; ModelBindingContext bindingContext = new ModelBindingContext() { FallbackToEmptyPrefix = true, ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, parameterType), ModelName = parameterName, ModelState = HostController.ViewData.ModelState, PropertyFilter = (p) => true, ValueProvider = valueProvider }; var parameterValue = modelBinder.BindModel(HostController.ControllerContext, bindingContext); if (parameterValue == null && methodParam.HasDefaultValue) parameterValue = methodParam.DefaultValue; result[i] = parameterValue; } return result; }
public static void Main (string[] args) { Console.WriteLine ("Hello World!"); Model model = new Model(typeof(Demo)); model.Write<ExtModel,ExtModelField>(); Store store = new Store(typeof(Demo)); store.Write(); List list = new List(typeof(Demo)); list.Write(); Form form = new Form(typeof(Demo)); form.Write(); Controller controller = new Controller(typeof(Demo)); controller.Write(); Application app = new Application(typeof(Demo)); app.Write(); Console.WriteLine ("This is The End my friend!"); }
public HomePageServer(Controller controller, int serverAccountId) { InitializeComponent(); _controller = controller; ServerAccountId = serverAccountId; var serverAccount = Model.ServerAccounts.Get(serverAccountId); panelSecondDeviceNotLinked.Visible = !serverAccount.LinkedDeviceSetup; SecondDeviceSetup = serverAccount.LinkedDeviceSetup; if (serverAccount.LinkedDeviceSetup) { if (serverAccount.LinkedDeviceCryptoKeyId == 0) { panelVerifyDeviceKeys.Visible = true; DeviceKeysVerified = false; } else { var linkedDeviceCryptoKey = Model.CryptoKeys.Get(serverAccount.LinkedDeviceCryptoKeyId); if (!linkedDeviceCryptoKey.Trust) { panelVerifyDeviceKeys.Visible = true; DeviceKeysVerified = false; } else { panelVerifyDeviceKeys.Visible = false; DeviceKeysVerified = true; } } } }
// Use this for initialization void Start() { controller = gameController.GetComponent<Controller>(); animator = this.GetComponent<Animator>(); animator.SetBool("floating", true); }
public static ActionResult NotFoundException(this Controller controller) { throw new HttpException(404, "Not Found"); }
protected override void Execute() { Controller.CreateNewProjectVersion(false); }
protected override void Execute() { Controller.ViewOnlineHelp(); }
protected override void Execute() { Controller.ViewAboutInfo(); }
protected override void Execute() { Controller.CompareProjectVersions(); }
/// <summary> /// 得到顶部 /// </summary> /// <param name="controller"></param> /// <returns></returns> public static string GetNoPicture(this Controller controller) { return(string.Format("{0}/Images/None.png", controller.GetUrl("PresentationWebsiteSharedUrl"))); }
/// <summary> /// 得到顶部 /// </summary> /// <param name="controller"></param> /// <returns></returns> public static string GetPreRenderPicture(this Controller controller) { return(string.Format("{0}/Images/PreRender.gif", controller.GetUrl("PresentationWebsiteSharedUrl"))); }
public sealed override void HandleReject(Controller controller) { controller.IdleState.RejectRotation(rotationIncrements); }
// Helper method to simplify shopping cart calls public static Blerja GetCart(Controller controller) { return(GetCart(controller.HttpContext)); }
public static JsonNetResult NewtonJson(this Controller controller, object model) { return(new JsonNetResult { Data = model }); }
public Content AddContent(Controller controller, HttpPostedFileBase file, int courseSid, out string message) { message = string.Empty; if (controller == null) { message = Constants.ValueIsEmpty(Constants.SourceController); return(null); } if (file == null || file.ContentLength == 0 || String.IsNullOrEmpty(file.FileName)) { message = Constants.ValueIsEmpty(Constants.File); return(null); } if (courseSid == 0) { message = Constants.ValueIsEmpty(Constants.Course); return(null); } var fileName = file.FileName; var fileExtension = Path.GetExtension(file.FileName); var fileSize = file.ContentLength; if (String.IsNullOrEmpty(fileExtension)) { message = Constants.UnknownValue(Constants.FileExtension); return(null); } var allowedFileExtension = Util.GetAllowedFileExtensionFromConfig(); if (!allowedFileExtension.Contains(fileExtension)) { message = Constants.OnlyValueAllowed(allowedFileExtension.Replace(".", "")); return(null); } var allowedFileSize = Util.GetAllowedFileSizeFromConfig(); if (fileSize > allowedFileSize * 1024 * 1024) { message = Constants.ValueNotAllowed(Constants.FileSize); return(null); } string GUIDFileName = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); var uploadFolder = Util.GetUploadFolderFromConfig(); // upload to file system if (Util.IsUploadLocationFileSystem()) { try { var uploadPath = Path.Combine(controller.Server.MapPath(uploadFolder), GUIDFileName); file.SaveAs(uploadPath); } catch (Exception ex) { ExceptionLog(ex); message = Constants.OperationFailedDuringSavingValue(Constants.File); return(null); } } // upload to blob else { try { Util.UploadToAzureStorage(file.InputStream, GUIDFileName, file.ContentType); } catch (Exception ex) { ExceptionLog(ex); message = Constants.OperationFailedDuringSavingValue(Constants.File); return(null); } } try { Content content = new Content(); content.CourseSid = courseSid; content.CreateDT = DateTime.Now; content.FileName = GUIDFileName; content.OriginalFileName = file.FileName; if (Util.GetVideoFormatsFromConfig().Contains(fileExtension)) { content.Type = Constants.Content_Type_Video; } else { content.Type = Constants.Content_Type_File; } content.Path = uploadFolder; using (var unitOfWork = new UnitOfWork(new ActiveLearningContext())) { unitOfWork.Contents.Add(content); unitOfWork.Complete(); return(content); } } catch (Exception ex) { ExceptionLog(ex); message = Constants.OperationFailedDuringAddingValue(Constants.File); return(null); } }
// public static void GetVidPid(string str, ref int vid, ref int pid) // { // var matches = Regex.Matches(str, @"VID_(\w{4})&PID_(\w{4})"); // if (matches.Count <= 0 || matches[0].Groups.Count <= 1) return; // vid = Convert.ToInt32(matches[0].Groups[1].Value, 16); // pid = Convert.ToInt32(matches[0].Groups[2].Value, 16); // } public void start() { // var stroke = new ManagedWrapper.Stroke(); // stroke.key.code = (ushort)Keys.J; // stroke.key.state = (ushort)ManagedWrapper.KeyState.Down; // int devId = 1; // ManagedWrapper.Send(_deviceContext, devId, ref stroke, 1); //use this code to determine keys // ManagedWrapper.SetFilter(deviceContext, ManagedWrapper.IsKeyboard, ManagedWrapper.Filter.All); // var stroke = new ManagedWrapper.Stroke(); // int device = 0; // while (ManagedWrapper.Receive(deviceContext, device = ManagedWrapper.Wait(deviceContext), ref stroke, 1) > 0) // { // if(ManagedWrapper.IsKeyboard(device) > 0) { // Console.WriteLine(stroke.key.code); // if(stroke.key.code == 1) // break; // } // } // ManagedWrapper.SetFilter(deviceContext, ManagedWrapper.IsKeyboard, ManagedWrapper.Filter.None); // var ret = new List<DeviceInfo>(); for (var i = 1; i < 21; i++) { var handle = ManagedWrapper.GetHardwareStr(deviceContext, i, 1000); if (handle == "") { continue; } // int foundVid = 0, foundPid = 0; // GetVidPid(handle, ref foundVid, ref foundPid); //if (foundVid == 0 || foundPid == 0) continue; // Console.WriteLine(i + " " + handle); // ret.Add(new DeviceInfo {Id = i, IsMouse = i > 10, Handle = handle}); } // foreach (var device in ret) // { // Console.WriteLine(device); // } var controllers = new[] { new Controller(), new Controller(UserIndex.One), new Controller(UserIndex.Two), new Controller(UserIndex.Three), new Controller(UserIndex.Four) }; // Get 1st controller available Controller controller = controllers[0]; foreach (var selectControler in controllers) { // Console.WriteLine(selectControler); if (selectControler.IsConnected) { controller = selectControler; break; } } if (controller == null) { Console.WriteLine("No XInput controller installed"); } else { Console.WriteLine("KeyMapper loaded"); // Console.WriteLine("Found a XInput controller available"); // Console.WriteLine("Press buttons on the controller to display events or escape key to exit... "); // Poll events from joystick SharpDX.XInput.State previousControllerState = controller.GetState(); Dictionary <Button, bool> lastSimpleGamepadState = determineSimpleButtonState(previousControllerState); StateTransition lastState = null; while (!ModuleData.getInstance().cancellationToken.IsCancellationRequested) { if (controller.IsConnected) { SharpDX.XInput.State controllerState = controller.GetState(); if (previousControllerState.PacketNumber != controllerState.PacketNumber) { // Console.WriteLine(controllerState.Gamepad); Dictionary <Button, bool> simpleGamepadState = determineSimpleButtonState(controllerState); Dictionary <Button, Settings.Action> changedState = determineStateDifferences(lastSimpleGamepadState, simpleGamepadState); printStateChanges(changedState); // Console.WriteLine(GetActiveWindowTitle()); //determine if we are transitioning to a new 'state' // this is based on the current state, the game state and the keys pressed/not pressed // NOTE: the first state wins, for speed StateTransition newState = getNewState(simpleGamepadState, ModuleData.getInstance().companionSettings.stateTransitions); if (newState == null && lastState == null) { //nothing to do } else if (newState != null && lastState == null) { activateState(newState); } else if (newState == null && lastState != null) { deactivateState(lastState); } else if (newState != null && lastState != null && !newState.transitionName.Equals(lastState.transitionName)) { deactivateState(lastState); activateState(newState); } //now that we have the state name determined, load the correct mappings StateControllerMapping stateControllerMappings = findStateControllerMappings(newState, ModuleData.getInstance().companionSettings.stateMappings); //apply button presses and such foreach (Button key in changedState.Keys) { Settings.Action action = changedState[key]; foreach (ControllerMapping controllerMapping in stateControllerMappings.controllerMappings) { if (controllerMapping.button.button == key && action == controllerMapping.button.action) { handleCommand(controllerMapping); } } } lastState = newState; lastSimpleGamepadState = simpleGamepadState; } Thread.Sleep(10); previousControllerState = controllerState; } } } }
public override void Draw(int aID) { var windowWidth = m_Rect.width; var windowHeight = m_Rect.height; actionTableRect = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, 0.5f * windowHeight); rightPanelRect = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.5f * windowHeight); descriptionRect = new Rect(0f, 0.6f * windowHeight, 0.95f * windowWidth, 0.2f * windowHeight); effectsRect = new Rect(0f, 0.8f * windowHeight, windowWidth, windowHeight * 0.15f); GUILayout.BeginArea(actionTableRect); GUILayout.BeginHorizontal(); GUILayout.Box(TC.get("Element.Action"), GUILayout.Width(windowWidth * 0.39f)); GUILayout.Box(TC.get("ActionsList.NeedsGoTo"), GUILayout.Width(windowWidth * 0.39f)); GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.1f)); GUILayout.EndHorizontal(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandWidth(false)); // Action table for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions().Count; i++) { if (i == selectedAction) { GUI.skin = selectedAreaSkin; } else { GUI.skin = noBackgroundSkin; } tmpTex = (Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getConditions() .getBlocksCount() > 0 ? conditionsTex : noConditionsTex); GUILayout.BeginHorizontal(); if (i == selectedAction) { int t = Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getType(); if (t == Controller.ACTION_USE_WITH || t == Controller.ACTION_GIVE_TO || t == Controller.ACTION_DRAG_TO) { selectedTarget = EditorGUILayout.Popup( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getTypeName(), selectedTarget, joinedNamesList, GUILayout.Width(windowWidth * 0.39f)); if (selectedTarget != selectedTargetLast) { ChangeActionTarget(selectedTarget); } } else { GUILayout.Label( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getTypeName(), GUILayout.Width(windowWidth * 0.39f)); } if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } } else { GUILayout.BeginHorizontal(GUILayout.Width(windowWidth * 0.39f)); Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].setNeedsGoTo( GUILayout.Toggle( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getNeedsGoTo(), "")); Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .setKeepDistance( EditorGUILayout.IntField( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i] .getKeepDistance())); GUILayout.EndHorizontal(); } if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f))) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getConditions ()); } } else { if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getTypeName(), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER) { if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } } else { if ( GUILayout.Button( Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getNeedsGoTo().ToString(), GUILayout.Width(windowWidth * 0.39f))) { OnActionSelectionChange(i); } } if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f))) { OnActionSelectionChange(i); } } GUILayout.EndHorizontal(); GUI.skin = defaultSkin; } GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Right panel */ GUILayout.BeginArea(rightPanelRect); GUI.skin = noBackgroundSkin; if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth))) { addMenu.menu.ShowAsContext(); } if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList() .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]); } //if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth))) //{ // Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]); //} //if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth))) //{ // Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ // GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]); //} if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth))) { Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList() .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction], false); if (selectedAction >= 0) { selectedAction--; } } GUI.skin = defaultSkin; GUILayout.EndArea(); GUILayout.BeginArea(descriptionRect); GUILayout.Label(TC.get("Action.Documentation")); GUILayout.Space(20); documentation = GUILayout.TextArea(documentation); if (!documentation.Equals(documentationLast)) { OnDocumentationChanged(documentation); } GUILayout.EndArea(); GUILayout.BeginArea(effectsRect); if (selectedAction < 0) { GUI.enabled = false; } if (GUILayout.Button(TC.get("Element.Effects"))) { EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow)); window.Init(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction] .getEffects()); } GUI.enabled = true; GUILayout.EndArea(); }
public EmptyReply Resolve(Controller controller) { return(null); }
private IActionResult InvokeAction(Controller controller, MethodInfo action, object[] actionParameters) => (IActionResult)action.Invoke(controller, actionParameters);
public ActionExecutedEventArgs(Controller controller, object model) { Controller = controller; Model = model; }
void ShowCharismaPlayerHandler(string evt, byte[] data) { Script = RenderScript("twopersonjobobjectmazecharisma.uis"); // background images UIPlayBackground = Script.Create <UIImage>("UIPlayBackground"); AddAt(0, UIPlayBackground); // all walls NorthWall = Script.Create <UIImage>("HWall"); NorthWall.Position = UIPlayBackground.Position; NorthWall.X += 13; NorthWall.Y += 11; Add(NorthWall); SouthWall = Script.Create <UIImage>("HWall"); SouthWall.Position = UIPlayBackground.Position; SouthWall.X += 13; SouthWall.Y += 61; Add(SouthWall); WestWall = Script.Create <UIImage>("VWall"); WestWall.Position = UIPlayBackground.Position; WestWall.X += 9; WestWall.Y += 14; Add(WestWall); EastWall = Script.Create <UIImage>("VWall"); EastWall.Position = UIPlayBackground.Position; EastWall.X += 59; EastWall.Y += 14; Add(EastWall); // create boxes // uigraphics / eods / twopersonjobobjectmaze / EOD_2PJobObj_Blue.bmp, Green.bmp, Red.bmp, Yellow.bmp var boxOffset = new Vector2(16, 18); ColoredBoxes = new UIImage[] { new UIImage(GetTexture(0x000007FD00000001)), new UIImage(GetTexture(0x000007FE00000001)), new UIImage(GetTexture(0x0000080100000001)), new UIImage(GetTexture(0x0000080400000001)), new UIImage(GetTexture(0x0000080300000001)) }; for (int index = 0; index < ColoredBoxes.Length; index++) { var box = ColoredBoxes[index]; box.UseTooltip(); box.ScaleX = box.ScaleY = 5.0f; box.Position = UIPlayBackground.Position + boxOffset; box.Visible = false; box.Tooltip = GameFacade.Strings.GetString("f112", index + BLUE_STRING_INDEX + ""); Add(box); } // the tooltip for the exit icon should be "Blue" ColoredBoxes[4].Tooltip = GameFacade.Strings.GetString("f112", "" + BLUE_STRING_INDEX); if (Waiting != null) { Remove(Waiting); } if (HWall != null) { Remove(HWall); } if (VWall != null) { Remove(VWall); } // labels: since they're useless in FreeSO's maze—as payouts are not happening—I've decided to make them help colorblind players if (PayoutCaption != null) { PayoutCaption.Alignment = TextAlignment.Left; PayoutCaption.Caption = SquareColorCaption; } if (PayoutField != null) { PayoutField.Alignment = TextAlignment.Left; // "Waiting for Logic Player" ShowWaitingMessageHandler(evt, data); // disables buttons, sets time to 0 } // add listeners to buttons, sscale them var offsetFat = North.Size.X * 0.5f; var offsetSkinny = North.Size.Y * 0.5f; North.OnButtonClick += (btn) => { Send("TSOMaze_Button_Click", new byte[] { (byte)AbstractMazeCellCardinalDirections.North }); }; North.ScaleX = North.ScaleY = 1.5f; North.X = North.X - offsetFat + 12; North.Y = North.Y - offsetSkinny + 2; West.OnButtonClick += (btn) => { Send("TSOMaze_Button_Click", new byte[] { (byte)AbstractMazeCellCardinalDirections.West }); }; West.ScaleX = West.ScaleY = 1.5f; West.X -= offsetSkinny; West.Y = West.Y - offsetFat + 9; East.OnButtonClick += (btn) => { Send("TSOMaze_Button_Click", new byte[] { (byte)AbstractMazeCellCardinalDirections.East }); }; East.ScaleX = East.ScaleY = 1.5f; East.X += 2; East.Y = East.Y - offsetFat + 9; South.OnButtonClick += (btn) => { Send("TSOMaze_Button_Click", new byte[] { (byte)AbstractMazeCellCardinalDirections.South }); }; South.ScaleX = South.ScaleY = 1.5f; South.X = South.X - offsetFat + 12; South.Y = South.Y - offsetSkinny + 6; UIPlayBackground.Y += 2; // show EOD Controller.ShowEODMode(new EODLiveModeOpt { Buttons = 0, Height = EODHeight.Tall, Length = EODLength.Full, Tips = EODTextTips.None, Timer = EODTimer.Normal, Expandable = false, Expanded = false }); }
public void OnCliked() { Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[ GameRources.GetInstance().selectedCharacterIndex].getActionsList() .addElement(Controller.ACTION_DRAG_TO, ""); }
async void OnScrollToRequested(object sender, ScrollToRequestedEventArgs e) { _checkedForRtlScroll = true; if (!_isAttached) { return; } // 99.99% of the time simply queuing to the end of the execution queue should handle this case. // However it is possible to end a layout cycle and STILL be layout requested. We want to // back off until all are done, even if they trigger layout storms over and over. So we back off // for 10ms tops then move on. var cycle = 0; while (IsLayoutRequested) { await Task.Delay(TimeSpan.FromMilliseconds(1)); if (_disposed) { return; } cycle++; if (cycle >= 10) { break; } } var context = Context; var x = (int)context.ToPixels(e.ScrollX); var y = (int)context.ToPixels(e.ScrollY); int currentX = _view.Orientation == ScrollOrientation.Horizontal || _view.Orientation == ScrollOrientation.Both ? _hScrollView.ScrollX : ScrollX; int currentY = _view.Orientation == ScrollOrientation.Vertical || _view.Orientation == ScrollOrientation.Both ? ScrollY : _hScrollView.ScrollY; if (e.Mode == ScrollToMode.Element) { Point itemPosition = Controller.GetScrollPositionForElement(e.Element as VisualElement, e.Position); x = (int)context.ToPixels(itemPosition.X); y = (int)context.ToPixels(itemPosition.Y); } if (e.ShouldAnimate) { ValueAnimator animator = ValueAnimator.OfFloat(0f, 1f); animator.SetDuration(1000); animator.Update += (o, animatorUpdateEventArgs) => { var v = (double)animatorUpdateEventArgs.Animation.AnimatedValue; int distX = GetDistance(currentX, x, v); int distY = GetDistance(currentY, y, v); if (_view == null) { // This is probably happening because the page with this Scroll View // was popped off the stack during animation animator.Cancel(); return; } switch (_view.Orientation) { case ScrollOrientation.Horizontal: _hScrollView.ScrollTo(distX, distY); break; case ScrollOrientation.Vertical: ScrollTo(distX, distY); break; default: _hScrollView.ScrollTo(distX, distY); ScrollTo(distX, distY); break; } }; animator.AnimationEnd += delegate { if (Controller == null) { return; } Controller.SendScrollFinished(); }; animator.Start(); } else { switch (_view.Orientation) { case ScrollOrientation.Horizontal: _hScrollView.ScrollTo(x, y); break; case ScrollOrientation.Vertical: ScrollTo(x, y); break; default: _hScrollView.ScrollTo(x, y); ScrollTo(x, y); break; } Controller.SendScrollFinished(); } }
private bool IsAuthorized(Controller controller, MethodInfo action) => action .GetCustomAttributes() .Where(a => a is AuthorizeAttribute) .Cast <AuthorizeAttribute>() .All(a => a.IsAuthorized(controller.Identity));
public static Minion MinionFromName(Controller controller, string cardName) { return(FromCard(controller, Cards.FromName(cardName)) as Minion); }
public static ShoppingCart GetCart(Controller controller) { return(GetCart(controller.HttpContext)); }
public static void Set <T>(this Controller controller, string key, T value) { controller.HttpContext.Session.SetString(key, JsonConvert.SerializeObject(value)); }
public static Playable PlayableFromName(Controller controller, string cardName) { return(FromCard(controller, Cards.FromName(cardName))); }
public static void ExportToExcel <T>(string workSheetName, IEnumerable <T> ts, Controller controller) { var dataTable = Repos <T> .Table(ts); using (XLWorkbook wb = new XLWorkbook()) { wb.Worksheets.Add(dataTable, workSheetName); //wb.SaveAs(folderPath + "DataGridViewExport.xlsx"); string myName = controller.Server.UrlEncode("Test" + "_" + DateTime.Now.ToShortDateString() + ".xlsx"); MemoryStream stream = GetStream(wb);// The method is defined below controller.Response.Clear(); controller.Response.Buffer = true; controller.Response.AddHeader("content-disposition", "attachment; filename=" + myName); controller.Response.ContentType = "application/vnd.ms-excel"; controller.Response.BinaryWrite(stream.ToArray()); controller.Response.End(); } }
public static void CleanModelErrors <TModel>(this Controller controller) { Type containerType = typeof(TModel); //Save the old modelstate var oldModelState = new ModelStateDictionary(); foreach (KeyValuePair <string, ModelStateEntry> modelState in controller.ModelState) { string propertyName = modelState.Key; foreach (ModelError error in modelState.Value.Errors) { bool exists = oldModelState.Any( m => m.Key == propertyName && m.Value.Errors.Any(e => e.ErrorMessage == error.ErrorMessage)); //add the inline message if it doesnt already exist if (!exists) { oldModelState.AddModelError(propertyName, error.ErrorMessage); } } } //Clear the model state ready for refill controller.ModelState.Clear(); foreach (KeyValuePair <string, ModelStateEntry> modelState in oldModelState) { //Get the property name string propertyName = modelState.Key; //Get the validation attributes PropertyInfo propertyInfo = string.IsNullOrWhiteSpace(propertyName) ? null : containerType.GetPropertyInfo(propertyName); List <ValidationAttribute> attributes = propertyInfo == null ? null : propertyInfo.GetCustomAttributes(typeof(ValidationAttribute), false).ToList <ValidationAttribute>(); //Get the display name var displayNameAttribute = propertyInfo?.GetCustomAttributes(typeof(DisplayNameAttribute), false).FirstOrDefault() as DisplayNameAttribute; var displayAttribute = propertyInfo?.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault() as DisplayAttribute; string displayName = displayNameAttribute != null ? displayNameAttribute.DisplayName : displayAttribute != null ? displayAttribute.Name : propertyName; foreach (ModelError error in modelState.Value.Errors) { string title = string.IsNullOrWhiteSpace(propertyName) ? error.ErrorMessage : null; string description = !string.IsNullOrWhiteSpace(propertyName) ? error.ErrorMessage : null; if (error.ErrorMessage.Like("The value * is not valid for *.")) { title = "There's a problem with your values."; description = "The value here is invalid."; } if (attributes != null && attributes.Any()) { ValidationAttribute attribute = attributes.FirstOrDefault(a => a.FormatErrorMessage(displayName) == error.ErrorMessage); if (attribute != null) { string validatorKey = $"{containerType.Name}.{propertyName}:{attribute.GetType().Name.TrimSuffix("Attribute")}"; CustomErrorMessage customError = CustomErrorMessages.GetValidationError(validatorKey); if (customError != null) { title = attribute.FormatError(customError.Title, displayName); description = attribute.FormatError(customError.Description, displayName); } } } //add the summary message if it doesnt already exist if (!string.IsNullOrWhiteSpace(title) && !controller.ModelState.Any(m => m.Key == "" && m.Value.Errors.Any(e => e.ErrorMessage == title))) { controller.ModelState.AddModelError("", title); } //add the inline message if it doesnt already exist if (!string.IsNullOrWhiteSpace(description) && !string.IsNullOrWhiteSpace(propertyName) && !controller.ModelState.Any( m => m.Key.EqualsI(propertyName) && m.Value.Errors.Any(e => e.ErrorMessage == description))) { controller.ModelState.AddModelError(propertyName, description); } } } }
public override void Draw(int aID) { var windowWidth = m_Rect.width; var windowHeight = m_Rect.height; previewRect = new Rect(0f, 0.5f * windowHeight, windowWidth, windowHeight * 0.45f); /* * View for videoscene */ if (Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[ GameRources.GetInstance().selectedCutsceneIndex].isVideoscene()) { // Background chooser GUILayout.Label(TC.get("Resources.DescriptionVideoscenes")); GUILayout.BeginHorizontal(); if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth))) { OnVideosceneChanged(""); } GUILayout.Box(videoscenePath, GUILayout.Width(0.6f * windowWidth)); if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.1f * windowWidth))) { ShowAssetChooser(AssetType.VIDEOSCENE); } GUILayout.EndHorizontal(); GUILayout.Space(30); GUILayout.Label(TC.get("Videoscene.Skip.border")); canSkipVideo = GUILayout.Toggle(canSkipVideo, new GUIContent(TC.get("Videoscene.Skip.label"))); if (canSkipVideo != canSkipVideoLast) { OnVideosceneCanSkipVideoChanged(canSkipVideo); } } /* * View for slidescene */ else { // Background chooser GUILayout.Label(TC.get("Resources.DescriptionSlidesceneSlides")); GUILayout.BeginHorizontal(); if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth))) { OnSlidesceneChanged(""); } GUILayout.Box(slidesPath, GUILayout.ExpandWidth(true)); if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.1f * windowWidth))) { ShowAssetChooser(AssetType.SELECT_SLIDES); } // Create/edit slidescene if (GUILayout.Button(TC.get("Resources.Create") + "/" + TC.get("Resources.Edit"), GUILayout.Width(0.18f * windowWidth))) { // For not-existing cutscene - show new cutscene name dialog if (slidesPath == null || slidesPath.Equals("")) { CutsceneNameInputPopup createCutsceneDialog = (CutsceneNameInputPopup)ScriptableObject.CreateInstance(typeof(CutsceneNameInputPopup)); createCutsceneDialog.Init(this, ""); } else { EditCutscene(); } } GUILayout.EndHorizontal(); // Music chooser GUILayout.BeginHorizontal(); if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth))) { musicPath = ""; } GUILayout.Box(musicPath, GUILayout.ExpandWidth(true)); if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth))) { ShowAssetChooser(AssetType.MUSIC); } GUILayout.EndHorizontal(); } GUILayout.Space(30); GUILayout.Label(TC.get("ImageAssets.Preview")); if (Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[ GameRources.GetInstance().selectedCutsceneIndex].isVideoscene()) { if (slidePreviewMovie != null) { GUI.DrawTexture(previewRect, slidePreviewMovie, ScaleMode.ScaleToFit); } } else { if (slidesPath != "" && slidesPreview != null) { GUI.DrawTexture(previewRect, slidesPreview, ScaleMode.ScaleToFit); } } }
public void InitFromController(Controller controller) { UserName = "******"; }
void OnVideosceneCanSkipVideoChanged(bool val) { canSkipVideoLast = val; Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[ GameRources.GetInstance().selectedCutsceneIndex].setCanSkip(val); }
public ControllerGuardClauses(Controller controller) { _controller = controller; _shortCamelCasedControllerName = controller.GetType().Name.ToShortCamelCasedControllerName(); }