//This called when you open a window and also sometimes if you press the Play button.
    void OnEnable()
    {
        //Debug.Log("Window OnEnable Called");

        //_actionsList = HelperMethods.GetDerivedTypes<ActionLogicBase>();

        if (_actionRecorder == null)
        {
            _actionRecorder = ActionRecorder.GetInstance(5); //Don't use createInstance...use GetInstance(stackSize).

            //Debug.Log("A new actionRecorder initialized");
        }

        //Define the actions after you have made sure you have an instance of actionRecorder.

        // Create instances of the action view's/GUI
        // so you can display it in the OnGUI method of the editor window.
        if (_radialSpreadAction == null)
        {
            //Don't use createInstance use GetInstance instead.
            _radialSpreadAction = RadialSpreadView.GetInstance<RadialSpreadView>(_actionRecorder);

            //Debug.Log("A new _radialSpreadAction initialized");
        }
    }
Exemple #2
0
 public virtual IGameletSelector Create(bool launchGameApiEnabled,
                                        ActionRecorder actionRecorder) =>
 launchGameApiEnabled
         ? new GameletSelector(_dialogUtil, _runner, _gameletSelectionWindowFactory,
                               _cancelableTaskFactory, _gameletClientFactory, _sshManager,
                               _remoteCommand, _gameLaunchBeHelper, _taskContext,
                               actionRecorder)
         : (IGameletSelector) new GameletSelectorLegacyFlow(_dialogUtil, _runner,
                                                            _gameletSelectionWindowFactory, _cancelableTaskFactory, _gameletClientFactory,
                                                            _sshManager, _remoteCommand, actionRecorder);
Exemple #3
0
    //Unity Functions
    //====================================================================================================================//

    private void Start()
    {
        transform = gameObject.transform;

        arrowRectTransform.gameObject.SetActive(false);

        InitButtons();
        ActionRecorder.InitButtons(recordButton, fadeImageObject);
        SetCodeWindowActive(false, null);
    }
    public static ActionRecorder GetInstance(int stackSize)
    {
        ActionRecorder instance = CreateInstance <ActionRecorder>();

        // Initializing stacks
        instance._undoActionStack = new ActionDropOutStack(stackSize);
        instance._redoActionStack = new ActionDropOutStack(stackSize);

        return(instance);
    }
Exemple #5
0
 public VsiGameLaunchFactory(IGameletClient gameletClient,
                             CancelableTask.Factory cancelableTaskFactory,
                             IGameLaunchBeHelper gameLaunchBeHelper,
                             ActionRecorder actionRecorder, IDialogUtil dialogUtil)
 {
     _gameletClient         = gameletClient;
     _cancelableTaskFactory = cancelableTaskFactory;
     _gameLaunchBeHelper    = gameLaunchBeHelper;
     _actionRecorder        = actionRecorder;
     _dialogUtil            = dialogUtil;
 }
 public HotkeyRecorderWindow()
 {
     WindowStartupLocation = WindowStartupLocation.CenterOwner;
     InitializeComponent();
     ViewModel = new HotkeyRecorderViewModel
     {
         ActionRecorder = ActionRecorder
     };
     DataContext = ViewModel;
     ActionRecorder.Focus();
     Closing += HotkeyRecorderWindow_Closing;
 }
Exemple #7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #8
0
 public Factory(CancelableTask.Factory cancelableTaskFactory,
                ActionRecorder actionRecorder,
                ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
                ILldbModuleUtil moduleUtil,
                ISymbolSettingsProvider symbolSettingsProvider)
 {
     _cancelableTaskFactory         = cancelableTaskFactory;
     _actionRecorder                = actionRecorder;
     _moduleUtil                    = moduleUtil;
     _symbolSettingsProvider        = symbolSettingsProvider;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
 }
 public void Setup()
 {
     _gameletClient         = Substitute.For <IGameletClient>();
     _cancelableTaskFactory = Substitute.For <CancelableTask.Factory>();
     _gameLaunchBeHelper    = Substitute.For <IGameLaunchBeHelper>();
     _metrics        = Substitute.For <IMetrics>();
     _actionRecorder = Substitute.For <ActionRecorder>(_metrics);
     _dialogUtil     = Substitute.For <IDialogUtil>();
     _launcher       = Substitute.For <IChromeClientsLauncher>();
     _params         = new LaunchParams();
     _launcher.LaunchParams.Returns(_params);
 }
Exemple #10
0
 public string getReportCard(ActionRecorder actionRecorder)
 {
     foreach (EvaluationItem item in items)
     {
         int count = 0;
         foreach (Action action in item.Actions)
         {
             count += actionRecorder.getCount(action);
         }
     }
     // 미완성
     return("score is null");
 }
Exemple #11
0
    //update runs unbounded
    //25-60 fps
    //lerp to each frame in the list
    //add a little bit of easing to the movements;
    //try DOTween and record all positions as places to go; moveTo, RotateBy,
    //if fixed timestep is not set oorrecctly, might look weird. Fixed timestep should be set so you're running at 60 fps.



    void FixedUpdate()
    {
        switch (recordingState)
        {
        case RecordingState.RECORDING:
            if (recordTime >= 0)
            {       //RECORDING happens here
                GameStateControl.gameState = GameStateControl.GameState.SIMULATION;
                RecordMovement(transform.position);
                RecordRotation(transform.eulerAngles, thisCamera.transform.eulerAngles.x);
                RecordWeaponActivity(isAttacking);
            }
            else       //what happens when RECORDING TIME reaches zero?
            {
                CommonFunctions.ResetPosAndRot(gameObject, startPos, startEuler);
                //find other player and reset their location; set to NOT_RECORDING to prevent loop ??
                ActionRecorder otherPlayerActionRecorder = PlayerSwitcherScript.otherPlayerStatic.GetComponent <ActionRecorder>();
                otherPlayerActionRecorder.recordingState = ActionRecorder.RecordingState.NOT_RECORDING;
                CommonFunctions.ResetPosAndRot(PlayerSwitcherScript.otherPlayerStatic, otherPlayerActionRecorder.startPos, otherPlayerActionRecorder.startEuler);
                GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemies");
                foreach (GameObject enemy in enemies)
                {
                    enemy.GetComponent <EnemyActionRecorder>().ResetEnemyPosAndRot();
                    Debug.Log("resetting enemy positions");
                }
                recordingState = RecordingState.NOT_RECORDING;
            }
            break;

        case RecordingState.PLAYBACK:
            // GameStateControl.gameState = GameStateControl.GameState.LIVE;
            // Debug.Log(this.gameObject.name + " is in playback mode");
            //check if player is alive before moving.
            if (!GetComponent <PlayerHealth>().playerIsDead)
            {
                MoveBasedOnRecording();
                RotateBasedOnRecording();
                AttackBasedOnRecording();
            }
            break;

        case RecordingState.NOT_RECORDING:
            ResetRecordTime();
            ToggleRecord(recordKey);
            GameStateControl.gameState = GameStateControl.GameState.SIMULATION;
            break;

        default:
            break;
        }
    }
    public static M GetInstance <M>(ActionRecorder actionRecorder)
        where M : ActionViewBase <T>
    {
        M instance = CreateInstance <M>();

        // Safety check - Throw an error we called CreateInstance<T>() On an abstract class!
        if (instance.GetType().IsAbstract)
        {
            throw new Exception("Can't call CreateInstance<" + instance.GetType().Name + "() on an abstract class");
        }

        instance.ActionRecorder = actionRecorder;
        return(instance);
    }
Exemple #13
0
 public GameLauncher(IGameletClient gameletClient, IYetiVSIService vsiService,
                     ILaunchGameParamsConverter launchGameParamsConverter,
                     CancelableTask.Factory cancelableTaskFactory,
                     ActionRecorder actionRecorder, IDialogUtil dialogUtil,
                     IVsiGameLaunchFactory vsiLaunchFactory)
 {
     _gameletClient             = gameletClient;
     _vsiService                = vsiService;
     _cancelableTaskFactory     = cancelableTaskFactory;
     _actionRecorder            = actionRecorder;
     _launchGameParamsConverter = launchGameParamsConverter;
     _dialogUtil                = dialogUtil;
     _vsiLaunchFactory          = vsiLaunchFactory;
 }
    /// <summary>
    /// Gets the instance.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="actionRecorder">The action recorder.</param>
    /// <returns>T.</returns>
    public static T GetInstance <T>(ActionRecorder actionRecorder) where T : ActionLogicBase
    {
        // Safety check - Throw an error we called GetInstance<T>() On an abstract class!
        Type type = typeof(T);

        if (type.IsAbstract)
        {
            throw new Exception("Can't use GetInstance<" + type.Name + ">() on an abstract class");
        }
        T instance = CreateInstance <T>();

        instance._actionRecorder = actionRecorder;
        return(CreateInstance <T>());
    }
Exemple #15
0
        public CoreAttachWindow(IServiceProvider serviceProvider)
        {
            var serviceManager = new ServiceManager();

            _taskContext = serviceManager.GetJoinableTaskContext();

            _dialogUtil = new DialogUtil();
            IExtensionOptions options =
                ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService)))
                .Options;
            var managedProcessFactory = new ManagedProcess.Factory();
            var progressDialogFactory = new ProgressDialog.Factory();

            _cancelableTaskFactory =
                new CancelableTask.Factory(_taskContext, progressDialogFactory);
            _coreListRequest = new CoreListRequest.Factory().Create();
            var jsonUtil = new JsonUtil();
            var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil);
            var accountOptionLoader     = new VsiAccountOptionLoader(options);
            var credentialManager       =
                new CredentialManager(credentialConfigFactory, accountOptionLoader);

            _developerAccount = credentialManager.LoadAccount();
            IRemoteCommand remoteCommand = new RemoteCommand(managedProcessFactory);

            _remoteFile = new RemoteFile(managedProcessFactory);
            var cloudConnection  = new CloudConnection();
            var sdkConfigFactory = new SdkConfig.Factory(jsonUtil);

            // NOTE: the lifetime of this CloudRunner is limited to the current CoreAttachWindow.
            _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection,
                                           new GgpSDKUtil());
            _gameletClientFactory = new GameletClient.Factory();
            var sshKeyLoader        = new SshKeyLoader(managedProcessFactory);
            var sshKnownHostsWriter = new SshKnownHostsWriter();

            _sshManager = new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader,
                                         sshKnownHostsWriter, remoteCommand);
            _debugSessionMetrics = new DebugSessionMetrics(
                serviceProvider.GetService(typeof(SMetrics)) as IMetrics);
            _debugSessionMetrics.UseNewDebugSessionId();
            _actionRecorder = new ActionRecorder(_debugSessionMetrics);

            InitializeComponent();
            _instanceSelectionWindowFactory = new ProjectInstanceSelection.Factory();
            _paramsFactory = new DebugEngine.DebugEngine.Params.Factory(jsonUtil);
            SelectInstanceOnInit();
        }
Exemple #16
0
        public int EnumPorts(out IEnumDebugPorts2 portsEnum)
        {
            var debugSessionMetrics = new DebugSessionMetrics(_metrics);

            debugSessionMetrics.UseNewDebugSessionId();
            var actionRecorder = new ActionRecorder(debugSessionMetrics);

            var action        = actionRecorder.CreateToolAction(ActionType.GameletsList);
            var gameletClient = _gameletClientFactory.Create(_cloudRunner.Intercept(action));
            var gameletsTask  = _cancelableTaskFactory.Create(
                "Querying instances...", () => gameletClient.ListGameletsAsync(onlyOwned: false));

            try
            {
                gameletsTask.RunAndRecord(action);
                List <Gamelet> gamelets = gameletsTask.Result;
                // show reserved instances first
                gamelets.Sort((g1, g2) =>
                {
                    if (g1.ReserverEmail != _developerAccount &&
                        g2.ReserverEmail != _developerAccount)
                    {
                        return(string.CompareOrdinal(g2.ReserverEmail, g1.ReserverEmail));
                    }

                    if (g1.ReserverEmail == _developerAccount &&
                        g2.ReserverEmail == _developerAccount)
                    {
                        return(string.CompareOrdinal(g2.DisplayName, g1.DisplayName));
                    }

                    return(g1.ReserverEmail == _developerAccount ? 1 : -1);
                });
                _ports = gamelets
                         .Select(gamelet => _debugPortFactory.Create(
                                     gamelet, this, debugSessionMetrics.DebugSessionId))
                         .ToList();
            }
            catch (CloudException e)
            {
                Trace.WriteLine(e.ToString());
                _dialogUtil.ShowError(e.Message);
                _ports.Clear();
            }

            portsEnum = new PortsEnum(_ports.ToArray());
            return(VSConstants.S_OK);
        }
        public void SetUp()
        {
            metrics = Substitute.For <IMetrics>();
            timer   = Substitute.For <ITimer>();
            timer.ElapsedMilliseconds.Returns(ElapsedMilliseconds);
            timerFactory = Substitute.For <Timer.Factory>();
            timerFactory.Create().Returns(timer);

            actionRecorder = new ActionRecorder(metrics, timerFactory);

            logEvent = new DeveloperLogEvent
            {
                StatusCode          = DeveloperEventStatus.Types.Code.Success,
                LatencyMilliseconds = ElapsedMilliseconds,
                LatencyType         = DeveloperLogEvent.Types.LatencyType.LatencyTool
            };
        }
Exemple #18
0
    private void InitButtons()
    {
        recordButton.onClick.AddListener(() =>
        {
            ActionRecorder.ToggleIsRecording();
            playButton.interactable   = !ActionRecorder.IsRecording;
            repeatButton.interactable = ActionRecorder.IsRecording;

            if (!ActionRecorder.IsRecording)
            {
                var newCommands = GenerateCode();
                selectedBot.SetCommands(newCommands);
            }

            arrowRectTransform.gameObject.SetActive(false);
        });
        _playButtonText = playButton.GetComponentInChildren <TMP_Text>();
        playButton.onClick.AddListener(() =>
        {
            selectedBot.SetPaused(false);
            UpdateButtons(selectedBot.IsPaused);
            repeatButton.interactable = false;

            arrowRectTransform.gameObject.SetActive(true);
        });
        stopButton.onClick.AddListener(() =>
        {
            selectedBot.SetPaused(true);
            UpdateButtons(selectedBot.IsPaused);
            repeatButton.interactable = true;

            arrowRectTransform.gameObject.SetActive(false);
        });


        nameInputField.onValueChanged.AddListener(SetBotName);


        closeCodeWindowButton.onClick.AddListener(() =>
        {
            SetCodeWindowActive(false, null);
        });

        repeatButton.onClick.AddListener(WrapWithRepeat);
    }
Exemple #19
0
        public MountConfiguration GetConfiguration(Gamelet gamelet, ActionRecorder actionRecorder)
        {
            MountConfiguration mountConfiguration = MountConfiguration.None;
            List <string>      mountsInfo         = ReadMountsContentOrDefault(gamelet, actionRecorder);

            if (mountsInfo.Count == 0)
            {
                return(mountConfiguration);
            }

            Dictionary <string, Device> devices = GetDevices(mountsInfo);
            Device gameAssetsDevice             = devices[YetiConstants.GameAssetsMountingPoint];
            Device developerDevice = devices[YetiConstants.DeveloperMountingPoint];
            Device packageDevice   = devices[YetiConstants.PackageMountingPoint];

            if (gameAssetsDevice?.FileSystemType.Equals(_overlayFileSystem, _comparisonType)
                ?? false)
            {
                mountConfiguration |= MountConfiguration.Overlay;
            }

            if (developerDevice?.FileSystemType.Equals(_sshFileSystem, _comparisonType) ?? false)
            {
                mountConfiguration |= MountConfiguration.LocalStreaming;
            }

            if (string.IsNullOrWhiteSpace(packageDevice?.Address))
            {
                if (gameAssetsDevice == null || developerDevice == null)
                {
                    return(mountConfiguration);
                }

                if (!gameAssetsDevice.Address.Equals(developerDevice.Address, _comparisonType))
                {
                    mountConfiguration |= MountConfiguration.RunFromPackage;
                }
            }
            else
            {
                mountConfiguration |= MountConfiguration.PackageMounted;
            }

            return(mountConfiguration);
        }
Exemple #20
0
 public GameletSelectorLegacyFlow(
     IDialogUtil dialogUtil, ICloudRunner runner,
     InstanceSelectionWindow.Factory gameletSelectionWindowFactory,
     CancelableTask.Factory cancelableTaskFactory,
     IGameletClientFactory gameletClientFactory, ISshManager sshManager,
     IRemoteCommand remoteCommand, ActionRecorder actionRecorder)
 {
     _dialogUtil = dialogUtil;
     _runner     = runner;
     _gameletSelectionWindowFactory = gameletSelectionWindowFactory;
     _cancelableTaskFactory         = cancelableTaskFactory;
     _gameletClientFactory          = gameletClientFactory;
     _sshManager    = sshManager;
     _remoteCommand = remoteCommand;
     _mountChecker  =
         new GameletMountChecker(remoteCommand, dialogUtil, cancelableTaskFactory);
     _actionRecorder = actionRecorder;
 }
Exemple #21
0
 DebugPort(DebugProcess.Factory debugProcessFactory,
           ProcessListRequest.Factory processListRequestFactory,
           CancelableTask.Factory cancelableTaskFactory, IDialogUtil dialogUtil,
           ISshManager sshManager, IMetrics metrics, Gamelet gamelet,
           IDebugPortSupplier2 supplier, string debugSessionId, string developerAccount)
 {
     _debugProcessFactory       = debugProcessFactory;
     _processListRequestFactory = processListRequestFactory;
     _dialogUtil            = dialogUtil;
     _guid                  = Guid.NewGuid();
     _supplier              = supplier;
     _developerAccount      = developerAccount;
     _cancelableTaskFactory = cancelableTaskFactory;
     _sshManager            = sshManager;
     _debugSessionMetrics   = new DebugSessionMetrics(metrics);
     _debugSessionMetrics.DebugSessionId = debugSessionId;
     _actionRecorder = new ActionRecorder(_debugSessionMetrics);
     Gamelet         = gamelet;
 }
Exemple #22
0
 public VsiGameLaunch(string launchName, bool isDeveloperResumeOfferEnabled,
                      IGameletClient gameletClient,
                      CancelableTask.Factory cancelableTaskFactory,
                      IGameLaunchBeHelper gameLaunchBeHelper, ActionRecorder actionRecorder,
                      IDialogUtil dialogUtil, int pollingTimeoutMs = 120 * 1000,
                      int pollingTimeoutResumeOfferMs = 120 * 60 * 1000,
                      int pollDelayMs = 500)
 {
     LaunchName = launchName;
     _isDeveloperResumeOfferEnabled = isDeveloperResumeOfferEnabled;
     _gameletClient               = gameletClient;
     _cancelableTaskFactory       = cancelableTaskFactory;
     _gameLaunchBeHelper          = gameLaunchBeHelper;
     _actionRecorder              = actionRecorder;
     _dialogUtil                  = dialogUtil;
     _pollingTimeoutMs            = pollingTimeoutMs;
     _pollingTimeoutResumeOfferMs = pollingTimeoutResumeOfferMs;
     _pollDelayMs                 = pollDelayMs;
 }
Exemple #23
0
 DebugModule(CancelableTask.Factory cancelableTaskFactory, ActionRecorder actionRecorder,
             ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
             ILldbModuleUtil moduleUtil, IModuleFileLoader moduleFileLoader,
             IModuleSearchLogHolder moduleSearchLogHolder, SbModule lldbModule,
             uint loadOrder, IDebugEngineHandler engineHandler, IGgpDebugProgram program,
             ISymbolSettingsProvider symbolSettingsProvider)
 {
     _cancelableTaskFactory         = cancelableTaskFactory;
     _actionRecorder                = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _moduleUtil            = moduleUtil;
     _moduleFileLoader      = moduleFileLoader;
     _moduleSearchLogHolder = moduleSearchLogHolder;
     _lldbModule            = lldbModule;
     _loadOrder             = loadOrder;
     _engineHandler         = engineHandler;
     _program = program;
     _symbolSettingsProvider = symbolSettingsProvider;
 }
Exemple #24
0
 void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.tag == "RecordingTrigger")
     {
         if (recordingState == RecordingState.NOT_RECORDING)
         {
             recordingState = RecordingState.RECORDING;
             //if this game object is NOT the presentplayer,
             ActionRecorder otherPlayerActionRecorder = PlayerSwitcherScript.otherPlayerStatic.GetComponent <ActionRecorder>();
             otherPlayerActionRecorder.recordingState = ActionRecorder.RecordingState.PLAYBACK;
             GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemies");
             foreach (GameObject enemy in enemies)
             {
                 enemy.GetComponent <EnemyActionRecorder>().ResetEnemyPosAndRot();
                 // enemy.GetComponent<EnemyActionRecorder>().recordingState = EnemyActionRecorder.RecordingState.RECORDING;
             }
             return;
         }
     }
 }
 public GameletSelector(IDialogUtil dialogUtil, ICloudRunner runner,
                        InstanceSelectionWindow.Factory gameletSelectionWindowFactory,
                        CancelableTask.Factory cancelableTaskFactory,
                        IGameletClientFactory gameletClientFactory, ISshManager sshManager,
                        IRemoteCommand remoteCommand, IGameLaunchBeHelper gameLaunchBeHelper,
                        JoinableTaskContext taskContext, ActionRecorder actionRecorder)
 {
     _dialogUtil = dialogUtil;
     _runner     = runner;
     _gameletSelectionWindowFactory = gameletSelectionWindowFactory;
     _cancelableTaskFactory         = cancelableTaskFactory;
     _gameletClientFactory          = gameletClientFactory;
     _sshManager    = sshManager;
     _remoteCommand = remoteCommand;
     _mountChecker  =
         new GameletMountChecker(remoteCommand, dialogUtil, cancelableTaskFactory);
     _gameLaunchBeHelper = gameLaunchBeHelper;
     _taskContext        = taskContext;
     _actionRecorder     = actionRecorder;
 }
Exemple #26
0
 void OnTriggerExit(Collider coll)
 {
     if (coll.gameObject.tag == "RecordingTrigger")
     {
         if (recordingState == RecordingState.RECORDING)
         {
             recordingState = RecordingState.NOT_RECORDING;
             ActionRecorder otherPlayerActionRecorder = PlayerSwitcherScript.otherPlayerStatic.GetComponent <ActionRecorder>();
             otherPlayerActionRecorder.recordingState = ActionRecorder.RecordingState.NOT_RECORDING;
             CommonFunctions.ResetPosAndRot(PlayerSwitcherScript.otherPlayerStatic, otherPlayerActionRecorder.startPos, otherPlayerActionRecorder.startEuler);
             GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemies");
             foreach (GameObject enemy in enemies)
             {
                 enemy.GetComponent <EnemyActionRecorder>().ResetEnemyPosAndRot();
                 // enemy.GetComponent<EnemyActionRecorder>().recordingState = EnemyActionRecorder.RecordingState.PLAYBACK;
             }
             return;
         }
     }
 }
 public DebugSessionLauncher(
     JoinableTaskContext taskContext, GrpcDebuggerFactory lldbDebuggerFactory,
     GrpcListenerFactory lldbListenerFactory, GrpcPlatformFactory lldbPlatformFactory,
     GrpcPlatformConnectOptionsFactory lldbPlatformConnectOptionsFactory,
     GrpcPlatformShellCommandFactory lldbPlatformShellCommandFactory,
     ILldbAttachedProgramFactory attachedProgramFactory, IDebugEngine3 debugEngine,
     LaunchOption launchOption, ActionRecorder actionRecorder,
     ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
     string coreFilePath, string executableFileName, string executableFullPath,
     LldbExceptionManager.Factory exceptionManagerFactory, IFileSystem fileSystem,
     bool fastExpressionEvaluation, IModuleFileFinder moduleFileFinder,
     IDumpModulesProvider dumpModulesProvider, IModuleSearchLogHolder moduleSearchLogHolder,
     ISymbolSettingsProvider symbolSettingsProvider,
     CoreAttachWarningDialogUtil warningDialog, IVsiGameLaunch gameLaunch)
 {
     _taskContext         = taskContext;
     _lldbDebuggerFactory = lldbDebuggerFactory;
     _lldbListenerFactory = lldbListenerFactory;
     _lldbPlatformFactory = lldbPlatformFactory;
     _lldbPlatformConnectOptionsFactory = lldbPlatformConnectOptionsFactory;
     _lldbPlatformShellCommandFactory   = lldbPlatformShellCommandFactory;
     _attachedProgramFactory            = attachedProgramFactory;
     _debugEngine             = debugEngine;
     _exceptionManagerFactory = exceptionManagerFactory;
     _fileSystem = fileSystem;
     _fastExpressionEvaluation      = fastExpressionEvaluation;
     _launchOption                  = launchOption;
     _actionRecorder                = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _coreFilePath                  = coreFilePath;
     _executableFileName            = executableFileName;
     _executableFullPath            = executableFullPath;
     _moduleFileFinder              = moduleFileFinder;
     _dumpModulesProvider           = dumpModulesProvider;
     _moduleSearchLogHolder         = moduleSearchLogHolder;
     _symbolSettingsProvider        = symbolSettingsProvider;
     _warningDialog                 = warningDialog;
     _gameLaunch = gameLaunch;
 }
Exemple #28
0
        public int AddPort(IDebugPortRequest2 request, out IDebugPort2 port)
        {
            var debugSessionMetrics = new DebugSessionMetrics(_metrics);

            debugSessionMetrics.UseNewDebugSessionId();
            var actionRecorder = new ActionRecorder(debugSessionMetrics);

            port = null;

            if (request.GetPortName(out string gameletIdOrName) != VSConstants.S_OK)
            {
                return(VSConstants.E_FAIL);
            }

            var action        = actionRecorder.CreateToolAction(ActionType.GameletGet);
            var gameletClient = _gameletClientFactory.Create(_cloudRunner.Intercept(action));
            var gameletTask   = _cancelableTaskFactory.Create(
                "Querying instance...",
                async() => await gameletClient.LoadByNameOrIdAsync(gameletIdOrName));

            try
            {
                gameletTask.RunAndRecord(action);
            }
            catch (CloudException e)
            {
                Trace.WriteLine(e.ToString());
                _dialogUtil.ShowError(e.Message);
                return(VSConstants.S_OK);
            }

            var debugPort = _debugPortFactory.Create(gameletTask.Result, this,
                                                     debugSessionMetrics.DebugSessionId);

            _ports.Add(debugPort);
            port = debugPort;
            return(VSConstants.S_OK);
        }
        public void SetUp()
        {
            _mockCancelableTaskFactory = Substitute.For <CancelableTask.Factory>();
            _mockModuleUtil            = Substitute.For <ILldbModuleUtil>();
            _mockModuleUtil.HasSymbolsLoaded(Arg.Any <SbModule>()).Returns(false);
            _mockModuleFileLoader      = Substitute.For <IModuleFileLoader>();
            _mockModuleSearchLogHolder = Substitute.For <IModuleSearchLogHolder>();
            _mockModule         = Substitute.For <SbModule>();
            _mockActionRecorder = Substitute.For <ActionRecorder>(null, null);
            var mockModuleFileLoadRecorderFactory =
                Substitute.For <ModuleFileLoadMetricsRecorder.Factory>();

            _mockEngineHandler          = Substitute.For <IDebugEngineHandler>();
            _mockDebugProgram           = Substitute.For <IGgpDebugProgram>();
            _mockSymbolSettingsProvider = Substitute.For <ISymbolSettingsProvider>();
            _debugModule =
                new DebugModule
                .Factory(_mockCancelableTaskFactory, _mockActionRecorder,
                         mockModuleFileLoadRecorderFactory, _mockModuleUtil,
                         _mockSymbolSettingsProvider)
                .Create(_mockModuleFileLoader, _mockModuleSearchLogHolder, _mockModule,
                        _testLoadOrder, _mockEngineHandler, _mockDebugProgram);
        }
Exemple #30
0
        public void TestActionRecorder()
        {
            var order = Order.Create(new Dictionary <string, object> {
                { "Vat", 3.0 }
            });

            var target = Order.Create(new Dictionary <string, object> {
                { "Vat", 1.0 }
            });

            using (var recorder = new ActionRecorder <IOrder>(order))
            {
                order.IncrementPrice(10);
                order.UpdateVat(2);
                order.IncrementPrice(70);

                var incr = order.IncrementPrice(40);
                var decr = order.DecrementPrice(20);

                Assert.Equal(120, incr);
                Assert.Equal(100, decr);

                Assert.Equal(100, order.Price);
                Assert.Equal(2, order.Vat);
                Assert.Equal(300, order.PriceWithVat);

                Assert.Equal(0, target.Price);
                Assert.Equal(1, target.Vat);
                Assert.Equal(0, target.PriceWithVat);

                recorder.Replay(target);

                Assert.Equal(100, target.Price);
                Assert.Equal(2, target.Vat);
                Assert.Equal(300, target.PriceWithVat);
            }
        }
    public void OnMouseOver()
    {
        if (!ActionRecorder.CanSelectBuildings)
        {
            return;
        }

        var selectedBot  = UIManager.Instance.selectedBot;
        var botTransform = selectedBot.transform;

        //left click
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (ActionRecorder.SelectingTarget)
            {
                ActionRecorder.SetBuildingTarget(this);
                return;
            }

            //TODO Take Item
            ActionRecorder.RecordActions(new ICommand[]
            {
                new StoreAndMoveToStoredTargetCommand(botTransform, selectedBot, this, selectedBot.Speed),
                new InteractableCommand(botTransform, selectedBot, false, selectedBot, Name, InteractableCommand.TYPE.BUILDING)
            });
        }
        //right click
        else if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            //TODO Give Item Here
            ActionRecorder.RecordActions(new ICommand[]
            {
                new StoreAndMoveToStoredTargetCommand(botTransform, selectedBot, this, selectedBot.Speed),
                new InteractableCommand(botTransform, selectedBot, true, selectedBot, Name, InteractableCommand.TYPE.BUILDING)
            });
        }
    }