public override void OnStartLocalPlayer() { base.OnStartLocalPlayer(); gameManager = GameObject.Find("[ Game Manager ]").GetComponent <ServerGameManager>(); gameObject.AddComponent <PlayerCursor>(); CameraManager.Instance?.HandleNewCharacter(cameraTransform); // absolutely garbo team picking, can implement with ITeam later though if (gameManager.playersConnected % 2 == 1) { greenTeam = true; this.transform.position = gameManager.teamSpawns[0].position; } else { greenTeam = false; this.transform.position = gameManager.teamSpawns[1].position; } CmdSetTeam(greenTeam); InputHandler = new KBM(); SendMessage("AssignInputs", InputHandler); }
private List <BoltExcuter> CreateLevel(List <string> levelList, Dictionary <string, DependItem> dependList) { var excuteList = new List <BoltExcuter>(); foreach (var item in levelList) { var boltInfo = dependList[item]; var bolt = (IBolt)Activator.CreateInstance(boltInfo.Type); if (bolt is BoltDelegate) { ((BoltDelegate)bolt).SetAction(boltInfo.BoltAction); } IInputs inputs = null; if (boltInfo.Previous != null) { inputs = new InputCollection(boltInfo.Previous, boltList); } else { inputs = this.userInput; } var boltExcuter = new BoltExcuter(bolt, inputs); this.boltList.Add(item, boltExcuter); excuteList.Add(boltExcuter); } return(excuteList); }
internal Topology(Dictionary <int, List <string> > levels, Dictionary <string, DependItem> list, DependItem mashupItem, ITopologyContainer container) { this.userInput = new UserInput(); this.boltList = new Dictionary <string, BoltExcuter>(); this.container = container; this.levelList = new Dictionary <int, List <BoltExcuter> >(); foreach (var level in levels) { levelList.Add(level.Key, this.CreateLevel(level.Value, list)); } IInputs mashupInput = null; if (levels.Count > 0) { mashupInput = new InputCollection(mashupItem.Previous, boltList); } else { mashupInput = this.userInput; } var mashup = (IMashup)Activator.CreateInstance(mashupItem.Type); if (mashup is MashupDelegate) { ((MashupDelegate)mashup).SetAction(mashupItem.MashupFunction); } this.mashupExcuter = new MashupExcuter(mashup, mashupInput); }
public PlayerInfo(/*Guid body, Guid foot,*/ IInputs input, Guid localId) { //this.body = body; //this.foot = foot; this.input = input ?? throw new ArgumentNullException(nameof(input)); LocalId = localId; }
public object Execute(IInputs inputs) { var p1 = (int)inputs.GetValue(); //Thread.Sleep(100); return(p1 + 100); }
private void OnEnable() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; inputs = GetComponent <PenguinBase>().InputHandler; }
public IOutputs GetBuckets(IInputs inputs) { IOutputs outputs; List <KeyValuePair <string, string> > headers; ForgeAPI.Interface.REST.IResult result; m_UtilityService.EnsureAuthenticationToken(inputs); headers = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CConstants.HEADER__AUTHORIZATION, $"Bearer {inputs.AuthenticationToken.AccessToken}") }; result = m_RESTService.Get( m_Configuration.APIURI_DataManagement_Buckets_GetBuckets, headers); outputs = m_Factory.CreateOutputs <IOutputs>(result); if (outputs.Success() == false) { return(outputs); } JsonConvert.PopulateObject( result.ResponseData, outputs, new JsonSerializerSettings() { ContractResolver = m_Resolver }); return(outputs); }
public void UpdateForNewGameState(GameState gameState) { switch (gameState) { case GameState.LevelSinglePlayer: inputs = MasterController.instance.gameObject.AddComponent <InputsLevelSinglePlayer>(); break; } }
public void Execute(IInputs input, IOutput output) { var p1 = (int)input.GetValue(); System.Diagnostics.Debug.WriteLine("BlotMock4" + Thread.CurrentThread.ManagedThreadId); Thread.Sleep(400); System.Diagnostics.Debug.WriteLine("BlotMock4" + Thread.CurrentThread.ManagedThreadId); output.Emit("out4", p1 + 40); }
public object Execute(IInputs inputs) { var p1 = (int)inputs.GetValue("out1"); var p2 = (int)inputs.GetValue("out2"); var p3 = (int)inputs.GetValue("out4"); Thread.Sleep(100); return(p1 + p2 + p3); }
public GameLoop() { display = new Display(); facade = new ConsoleFacade(); field = new Field(); fieldAlterations = new FieldAlterations(); file = new FileWorker(); simulation = new Simulation(); inputs = new Inputs(); texts = new Texts(); }
public void Execute(IInputs input, IOutput output) { if (i == 0) { i++; throw new NotImplementedException(); } else { var p1 = (int)input.GetValue(); System.Diagnostics.Debug.WriteLine("BlotMock1" + Thread.CurrentThread.ManagedThreadId); Thread.Sleep(100); System.Diagnostics.Debug.WriteLine("BlotMock1" + Thread.CurrentThread.ManagedThreadId); output.Emit("out1", p1 + 10); } }
/// <summary> /// Sends inputs to the Inter Mod Communication's <see cref="Inputs"/> structure. /// </summary> public void SendInputs(ref IInputs inputs, int port) { if (_controllers.TryGetValue(port, out var controllerTuple)) { var controller = controllerTuple.Controller; var config = controllerTuple.Config; if (!controller.IsConnected) { return; } controller.GetState(out State state); Converter.ToHeroesController(ref state, ref inputs, config); } }
private async Task CreatePlayer(Guid body, IInputs inputs, byte[] color) { var newPlayer = new PlayerInfo(inputs, body); var added = false; while (!added) { try { localPlayers.Run(x => { x.Add(newPlayer); return(x); }); added = true; } catch (Exception e) { var db = 0; } } //var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; //} //var name = ""; //if (localSettings.Values.TryGetValue(LocalSettingsKeys.PlayerName, out var savedName)) //{ // name = (string)savedName; //} Random r = new Random(); game.CreatePlayer( new AddPlayerEvent(body, "", BodyA, color[0], color[1], color[2], 0xff, color[0], color[1], color[2], new Physics2.Vector(fieldDimensions.xMax * r.NextDouble(), fieldDimensions.yMax * r.NextDouble()) )); }
/// <summary> /// Sends inputs to the Inter Mod Communication's <see cref="Inputs"/> structure. /// </summary> public void PostProcessInputs(ref IInputs inputs, int port) { var config = _configurations[port]; inputs.LeftStickX = config.LeftStickXDeadzone.ApplySettings(inputs.LeftStickX); inputs.LeftStickY = config.LeftStickYDeadzone.ApplySettings(inputs.LeftStickY); inputs.RightStickX = config.RightStickXDeadzone.ApplySettings(inputs.RightStickX); inputs.RightStickY = config.RightStickYDeadzone.ApplySettings(inputs.RightStickY); inputs.LeftTriggerPressure = config.LeftTriggerDeadzone.ApplySettings(inputs.LeftTriggerPressure); inputs.RightTriggerPressure = config.RightTriggerDeadzone.ApplySettings(inputs.RightTriggerPressure); if (config.SwapTriggers) { byte leftTriggerPressure = inputs.LeftTriggerPressure; inputs.LeftTriggerPressure = inputs.RightTriggerPressure; inputs.RightTriggerPressure = leftTriggerPressure; } }
public void StartBot(bool isOnGreenTeam) { if (!isServer) { return; } navMeshAgent = GetComponent <NavMeshAgent>(); gameManager = GameObject.Find("[ Game Manager ]").GetComponent <ServerGameManager>(); greenTeam = isOnGreenTeam; RpcSetTeam(isOnGreenTeam); InputHandler = new Inputs.Bot(); SendMessage("AssignInputs", InputHandler); isBot = isServer && !isLocalPlayer; CreateStates(); }
public IOutputs GetManifest(IInputs inputs) { IOutputs outputs; List <KeyValuePair <string, string> > headers; ForgeAPI.Interface.REST.IResult result; string encodedURN; m_UtilityService.EnsureAuthenticationToken(inputs); headers = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CConstants.HEADER__AUTHORIZATION, $"Bearer {inputs.AuthenticationToken.AccessToken}") }; encodedURN = inputs.URN; if (inputs.URNIsEncoded == false) { encodedURN = m_UtilityService.ConvertToBase64(encodedURN); } result = m_RESTService.Get( m_Configuration.APIURI_ModelDerivative_Derivatives_GetManifest .Replace("{urn}", encodedURN), headers); outputs = m_Factory.CreateOutputs <IOutputs>(result); if (outputs.Success() == false) { return(outputs); } JsonConvert.PopulateObject( result.ResponseData, outputs, new JsonSerializerSettings() { ContractResolver = m_Resolver }); return(outputs); }
public IOutputs UploadObject(IInputs inputs) { IOutputs outputs; List <KeyValuePair <string, string> > headers; ForgeAPI.Interface.REST.IResult result; m_UtilityService.EnsureAuthenticationToken(inputs); headers = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CConstants.HEADER__AUTHORIZATION, $"Bearer {inputs.AuthenticationToken.AccessToken}"), new KeyValuePair <string, string>(CConstants.HEADER__CONTENT_TYPE, inputs.ContentType), new KeyValuePair <string, string>(CConstants.HEADER__CONTENT_LENGTH, inputs.FileData.LongLength.ToString()) }; result = m_RESTService.Put( m_Configuration.APIURI_DataManagement_Objects_UploadObject .Replace("{bucketKey}", inputs.BucketKey) .Replace("{objectName}", inputs.ObjectName), inputs.FileData, headers); outputs = m_Factory.CreateOutputs <IOutputs>(result); if (outputs.Success() == false) { return(outputs); } JsonConvert.PopulateObject( result.ResponseData, outputs, new JsonSerializerSettings() { ContractResolver = m_Resolver }); return(outputs); }
public void Execute(IInputs input, IOutput output) { var p1 = (int)input.GetValue(); lock (count) { int c = 0; if (count.TryGetValue(Thread.CurrentThread.ManagedThreadId, out c)) { c++; } else { count.Add(Thread.CurrentThread.ManagedThreadId, 1); } } // System.Diagnostics.Debug.WriteLine("BlotMock1 " + Thread.CurrentThread.ManagedThreadId); Thread.Sleep(3000); // System.Diagnostics.Debug.WriteLine("BlotMock1" + Thread.CurrentThread.ManagedThreadId); output.Emit("out1", p1 + 10); }
public IOutputs DeleteBucket(IInputs inputs) { IOutputs outputs; List <KeyValuePair <string, string> > headers; ForgeAPI.Interface.REST.IResult result; m_UtilityService.EnsureAuthenticationToken(inputs); headers = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CConstants.HEADER__AUTHORIZATION, $"Bearer {inputs.AuthenticationToken.AccessToken}") }; result = m_RESTService.Delete( m_Configuration.APIURI_DataManagement_Buckets_DeleteBucket.Replace("{bucketKey}", inputs.BucketKey), headers); outputs = m_Factory.CreateOutputs <IOutputs>(result); return(outputs); }
public IOutputs AddJob(IInputs inputs) { IOutputs outputs; List <KeyValuePair <string, string> > headers; ForgeAPI.Interface.REST.IResult result; m_UtilityService.EnsureAuthenticationToken(inputs); headers = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CConstants.HEADER__AUTHORIZATION, $"Bearer {inputs.AuthenticationToken.AccessToken}"), new KeyValuePair <string, string>(CConstants.HEADER__CONTENT_TYPE, CConstants.MEDIA_TYPE__JSON), new KeyValuePair <string, string>(CConstants.HEADER__ADS_FORCE, inputs.ReplaceExistingDerivatives.ToString().ToLower()) }; result = m_RESTService.Post( m_Configuration.APIURI_ModelDerivative_Derivatives_PostJob, inputs, headers); outputs = m_Factory.CreateOutputs <IOutputs>(result); if (outputs.Success() == false) { return(outputs); } JsonConvert.PopulateObject( result.ResponseData, outputs, new JsonSerializerSettings() { ContractResolver = m_Resolver }); return(outputs); }
public IOutputs DownloadObjectURI(IInputs inputs) { IOutputs outputs; List <KeyValuePair <string, string> > headers; ForgeAPI.Interface.REST.IResult result; m_UtilityService.EnsureAuthenticationToken(inputs); headers = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CConstants.HEADER__AUTHORIZATION, $"Bearer {inputs.AuthenticationToken.AccessToken}") }; result = m_RESTService.GetBinary( inputs.URI, headers); outputs = m_Factory.CreateOutputs <IOutputs>(result); outputs.ObjectData = result.ResponseBinaryData; return(outputs); }
/// <summary> /// TBD /// </summary> /// <param name="inputs">TBD</param> /// <returns>TBD</returns> public static TransferState NeedsInputOrComplete(IInputs inputs) => new LambdaTransferState(() => inputs.AreInputsAvailable || inputs.AreInputsDepleted, () => false);
/// <summary> /// TBD /// </summary> /// <param name="inputs">TBD</param> /// <returns>TBD</returns> public static TransferState NeedsInput(IInputs inputs) => new LambdaTransferState(() => inputs.AreInputsAvailable, () => inputs.AreInputsDepleted);
// these do not really work with multiple players //readonly Guid body = Guid.NewGuid(); //readonly Guid outer = Guid.NewGuid(); //readonly Guid foot = Guid.NewGuid(); //private async Task CreatePlayer(ControlScheme controlScheme, Guid id) //{ // IInputs inputs = null; // switch (controlScheme) // { // case ControlScheme.MouseAndKeyboard: // inputs = new MouseKeyboardInputs(lockCurser, game, id); // break; // case ControlScheme.SipmleMouse: // var (temp, refx, refy) = SimpleMouseInputs.Create(lockCurser, game, body, foot, fieldDimensions.xMax / 2.0, fieldDimensions.yMax / 2.0); // inputs = temp; // rge.InitMouse(refx, refy); // break; // case ControlScheme.Controller: // throw new NotImplementedException(); // break; // default: // break; // } // await inputs.Init(); // var newPlayer = new PlayerInfo(/*body, foot,*/ inputs, id); // var added = false; // while (!added) // { // try // { // localPlayers.Run(x => { x.Add(newPlayer); return x; }); // added = true; // } // catch (Exception e) // { // var db = 0; // } // } // //var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; // var color = GetColor(); // //} // //var name = ""; // //if (localSettings.Values.TryGetValue(LocalSettingsKeys.PlayerName, out var savedName)) // //{ // // name = (string)savedName; // //} // game.CreatePlayer( // new AddPlayerEvent(id, // "", // BodyA, // color[0], // color[1], // color[2], // 0xff, // color[0], // color[1], // color[2], // new Physics2.Vector(fieldDimensions.xMax/2.0, fieldDimensions.yMax/2.0) // )); //} private async Task CreatePlayer(Guid body, IInputs inputs) { var color = GetColor(); await CreatePlayer(body, inputs, color); }
public FieldAlterations() { field = new Field(); inputs = new Inputs(); generator = new Random(DateTime.Now.Millisecond); }
public static TransferState NeedsInputOrComplete(IInputs inputs) => new LambdaTransferState(() => inputs.AreInputsAvailable || inputs.AreInputsDepleted, () => false);
public static TransferState NeedsInput(IInputs inputs) => new LambdaTransferState(() => inputs.AreInputsAvailable, () => inputs.AreInputsDepleted);
private void SetInputs(ref IInputs inputs, int port) => _input.SetInputs(ref inputs, port);
public void Inputs(IInputs inputs) { this.inputs = inputs; }
private void OnSetInputs(ref IInputs inputs, int port) => _xInput.SendInputs(ref inputs, port);
public static void ToHeroesController(ref State state, ref IInputs inputs, Config configuration) { // Buttons if (XInputButtonPressed(ref state, configuration.Jump)) { inputs.ButtonFlags |= ButtonFlags.Jump; } if (XInputButtonPressed(ref state, configuration.FormationR)) { inputs.ButtonFlags |= ButtonFlags.FormationR; } if (XInputButtonPressed(ref state, configuration.Action)) { inputs.ButtonFlags |= ButtonFlags.Action; } if (XInputButtonPressed(ref state, configuration.FormationL)) { inputs.ButtonFlags |= ButtonFlags.FormationL; } if (XInputButtonPressed(ref state, configuration.CameraL)) { inputs.ButtonFlags |= ButtonFlags.CameraL; } if (XInputButtonPressed(ref state, configuration.CameraR)) { inputs.ButtonFlags |= ButtonFlags.CameraR; } if (XInputButtonPressed(ref state, configuration.Start)) { inputs.ButtonFlags |= ButtonFlags.Start; } if (XInputButtonPressed(ref state, configuration.TeamBlast)) { inputs.ButtonFlags |= ButtonFlags.TeamBlast; } if (XInputButtonPressed(ref state, configuration.DpadUp)) { inputs.ButtonFlags |= ButtonFlags.DpadUp; } if (XInputButtonPressed(ref state, configuration.DpadDown)) { inputs.ButtonFlags |= ButtonFlags.DpadDown; } if (XInputButtonPressed(ref state, configuration.DpadLeft)) { inputs.ButtonFlags |= ButtonFlags.DpadLeft; } if (XInputButtonPressed(ref state, configuration.DpadRight)) { inputs.ButtonFlags |= ButtonFlags.DpadRight; } // Triggers. inputs.LeftStickX = XInputRangeToHeroesRange(state.Gamepad.LeftThumbX); inputs.LeftStickY = XInputRangeToHeroesRange(state.Gamepad.LeftThumbY * -1); inputs.RightStickX = XInputRangeToHeroesRange(state.Gamepad.RightThumbX); inputs.RightStickY = XInputRangeToHeroesRange(state.Gamepad.RightThumbY * -1); inputs.LeftTriggerPressure = state.Gamepad.LeftTrigger; inputs.RightTriggerPressure = state.Gamepad.RightTrigger; }