Beispiel #1
0
    //private void RequestRecentMatches()
    //{

    //}

    /*public void SendRequestFullGame(MatchSignature matchSignature)
     * {
     *  //var matchSig = MatchInfo.DecodeShareCode("CSGO-WMw4F-5EYMy-7Hk79-JhRrm-tNTWJ");
     *  //RequestFullGameInfo(matchSig.matchId, matchSig.outcomeId, matchSig.token);
     *  if (SteamController.steamInScene != null && SteamController.steamInScene.IsLoggedIn && !SteamController.steamInScene.steam3.isAnon)
     *  {
     *      SteamController.LogToConsole("\nRequesting full game info");
     *      //blockRefresh = true;
     *
     *      var account = SteamController.steamInScene.GetFriendWithAccountId(SteamController.steamInScene.userAccountId);
     *      userLastState = account != null ? account.GetState() : (SteamKit2.EPersonaState)SettingsController.personaState;
     *
     *      SteamController.steamInScene.SetPersonaState(SteamKit2.EPersonaState.Invisible);
     *      SteamController.steamInScene.PlayCStrike();
     *      StartCoroutine(CommonRoutines.WaitToDoAction(() =>
     *      {
     *          SteamController.steamInScene.RequestFullGameInfo(matchSignature.matchId, matchSignature.outcomeId, matchSignature.token);
     *          //lastRecentMatchesRequest = Time.time;
     *          //blockRefresh = false;
     *      }, 30, () => SteamController.steamInScene.playingApp == 730));
     *  }
     * }
     * public void RequestRecentMatches()
     * {
     *  if (SteamController.steamInScene != null && SteamController.steamInScene.IsLoggedIn && !SteamController.steamInScene.steam3.isAnon && !blockRefresh && Time.time - lastRecentMatchesRequest > recentMatchesRequestCooldown)
     *  {
     *      SteamController.LogToConsole("\nRequesting recent matches");
     *      blockRefresh = true;
     *
     *      var account = SteamController.steamInScene.GetFriendWithAccountId(SteamController.steamInScene.userAccountId);
     *      userLastState = account != null ? account.GetState() : (SteamKit2.EPersonaState)SettingsController.personaState;
     *
     *      SteamController.steamInScene.SetPersonaState(SteamKit2.EPersonaState.Invisible);
     *      SteamController.steamInScene.PlayCStrike();
     *      StartCoroutine(CommonRoutines.WaitToDoAction(() =>
     *      {
     *          SteamController.steamInScene.RequestRecentGamesPlayed(SteamController.steamInScene.userAccountId);
     *          lastRecentMatchesRequest = Time.time;
     *          blockRefresh = false;
     *      }, 30, () => { return SteamController.steamInScene.playingApp == 730; }, () => { lastRecentMatchesRequest = Time.time; blockRefresh = false; }));
     *  }
     * }*/
    private void GetOfflineDemos()
    {
        SteamController.LogToConsole("\nFinding matches on device");
        IEnumerable <string> demoFiles = null;

        if (Directory.Exists(SettingsController.matchesLocation))
        {
            demoFiles = Directory.EnumerateFiles(SettingsController.matchesLocation, "*.dem");
        }
        else
        {
            SteamController.LogToConsole("Matches directory does not exist");
        }

        if (demoFiles != null)
        {
            SteamController.LogToConsole("Found " + demoFiles.Count() + " match(es) on device");
            foreach (string file in demoFiles)
            {
                TaskManagerController.RunAction(() =>
                {
                    MatchInfo.FindOrCreateMatch(Path.GetFileNameWithoutExtension(file));
                    //AddAvailableMatch(match);
                });
            }
            RefreshList();
        }
        else
        {
            SteamController.LogToConsole("Did not find any match(es) on device");
        }
    }
    public void DeleteFile()
    {
        CancelUpdateCheckTask();
        if (item != null && item is DepotDownloader.ProtoManifest.FileData)
        {
            var resourcePakData = (DepotDownloader.ProtoManifest.FileData)item;

            string fileName = Path.GetFileNameWithoutExtension(resourcePakData.FileName);
            SteamController.ShowPromptPopup("Delete File", "Are you sure you want to delete the file '" + fileName + "'? This cannot be undone.", (yes) =>
            {
                if (yes)
                {
                    string fullFilePath = Path.Combine(SettingsController.gameLocation, resourcePakData.FileName);
                    if (File.Exists(fullFilePath))
                    {
                        File.Delete(fullFilePath);
                    }
                    else
                    {
                        SteamController.ShowErrorPopup("File Not Found", "Could not find file '" + fileName + "' in filesystem.");
                    }

                    RefreshItemInfo();
                    ResourcePacksPanel.resourcePacksPanelInScene.RecheckSizeOnDisk();
                    ResourcePacksPanel.resourcePacksPanelInScene.RecheckDownloadSize();
                }
            }, "Yes", "No");
        }
        else
        {
            SteamController.ShowErrorPopup("Unexpected Error", "An unexpected error occured.");
        }
    }
Beispiel #3
0
    private void CancellableStartLoadMap(CancellationToken cancelToken, Action onCompleted = null)
    {
        loadedMap?.UnloadMap();
        loadedMap = this;

        //status = "Loading Map";

        CreateMapObjectIfNotExist();

        if (map != null)
        {
            SteamController.LogToConsole("\nLoading " + map.mapName);
            try
            {
                map.ParseFile(cancelToken, null, null);
            }
            catch (Exception e)
            {
                Debug.LogError("MapData: Error while loading map " + e.ToString());
            }

            if (!cancelToken.IsCancellationRequested)
            {
                MakeGameObject(onCompleted);
            }
            else
            {
                UnloadMap();
            }
        }
    }
Beispiel #4
0
 public TaskWrapper GetDownloadTask(Action <bool> onMatchDownloaded = null)
 {
     if (downloadTask == null)
     {
         string downloadUrl = GetDownloadUrl();
         Debug.Assert(!string.IsNullOrEmpty(downloadUrl), "MatchInfo: Could not get download url");
         //if (!string.IsNullOrEmpty(downloadUrl))
         //{
         downloadTask = SteamController.GenerateDownloadTask(downloadUrl, true, GetMatchFilePath(), (success, data) =>
         {
             if (success)
             {
                 if (matchInfoData != null)
                 {
                     SaveMatchInfoTo(matchInfoData, GetInfoFilePath());
                 }
             }
             onMatchDownloaded?.Invoke(success);
         }, (progress) =>
         {
             downloadProgress = progress / 100f;
         },
                                                             (exception) =>
         {
             TaskManagerController.RunAction(() =>
             {
                 SteamController.ShowErrorPopup("Download Error", "Could not retrieve the match: " + exception.ToString());
             });
         });
         //}
     }
     return(downloadTask);
 }
Beispiel #5
0
 private void Application_lowMemory()
 {
     if (IsLoading3D)
     {
         CancelLoading3D();
         SteamController.ShowErrorPopup("Loading Error", "Not enough ram to load this map. You can try tweaking the settings to maybe get it working. It would be best to restart the application to make sure the ram clears out properly.");
     }
 }
        public void TestBuildGetPlayerSummariesRequestUrl()
        {
            SteamController steamController = new SteamController(new MockedApiKeys());
            string          expectedUrl     = $"http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=Test&steamids=123";
            string          url             = steamController.BuildGetPlayerSummariesRequestUrl(DashSan.MobileAppService.Models.Steam.Enums.SteamEnums.Methods.GetPlayerSummaries, "123");

            Assert.Equal(expectedUrl, url);
        }
Beispiel #7
0
 private void CurrentDemoParser_PlayerHurt(object sender, PlayerHurtEventArgs e)
 {
     SteamController.LogToConsole((e.Player != null ? e.Player.Name : "Nobody") + " was hurt by " + (e.Attacker != null ? e.Attacker.Name : "nobody") + " using " + (e.Weapon != null ? e.Weapon.OriginalString : "nothing") + " and took " + e.HealthDamage + " hp damage and " + e.ArmorDamage + " armor damage");
     if (e.Player != null)
     {
         SetIsHurt(e.Player.EntityID);
     }
 }
Beispiel #8
0
 private void CurrentDemoParser_WeaponFired(object sender, WeaponFiredEventArgs e)
 {
     SteamController.LogToConsole((e.Shooter != null ? e.Shooter.Name : "Nobody") + " fired " + (e.Weapon != null ? e.Weapon.OriginalString : "nothing"));
     if (e.Shooter != null)
     {
         SetIsFiring(e.Shooter.EntityID);
     }
 }
Beispiel #9
0
 private void RegisterControllers()
 {
     _steamController     = new SteamController(CuratorDataSet);
     _consoleController   = new ConsoleController(CuratorDataSet.Console);
     _romController       = new RomController(CuratorDataSet.ROM);
     _romFolderController = new RomFolderController(CuratorDataSet.RomFolder);
     _saveLoadController  = new SaveLoadController(CuratorDataSet);
 }
 private void RequestPassword(SteamKit2.EResult result)
 {
     //SteamController.LogToConsole("Login Key expired");
     TaskManagerController.RunAction(() =>
     {
         SettingsController.ForgetUser();
         SteamController.ShowErrorPopup("Login Error", "Login key expired please log in again");
     });
 }
Beispiel #11
0
    private void CurrentDemoParser_RoundEnd(object sender, RoundEndedEventArgs e)
    {
        SteamController.LogToConsole("Round ended. " + e.Winner + " forces won the round. " + e.Reason + ". " + e.Message + ".");

        if (e.Winner != Team.Spectate)
        {
            string teamName = e.Winner == Team.CounterTerrorist ? "Counter-Terrorists" : "Terrorists";
            ShowWinText(teamName + "\n" + "Win");
        }
    }
 public bool OpenSteamControllerConfig(ISteamController controller)
 {
     if (controller is SteamworksSteamController)
     {
         return(SteamController.ShowBindingPanel(
                    ((SteamworksSteamController)controller).Handle
                    ));
     }
     return(false);
 }
Beispiel #13
0
 //public void CheckForNewMatches()
 //{
 //    GetOfflineDemos();
 //    RequestRecentMatches();
 //}
 private void SteamInScene_onRecentGamesReceived(SteamKit2.GC.CSGO.Internal.CMsgGCCStrike15_v2_MatchList matchList)
 {
     SteamController.LogToConsole("\nReceived " + matchList.matches.Count() + " match(es)");
     TaskManagerController.RunAction(() =>
     {
         foreach (var match in matchList.matches)
         {
             MatchInfo.FindOrCreateMatch(match);
         }
         RefreshList();
     });
 }
Beispiel #14
0
    private void CurrentDemoParser_FlashNadeExploded(object sender, FlashEventArgs e)
    {
        string playersEffected = "";

        if (e.FlashedPlayers != null)
        {
            foreach (var player in e.FlashedPlayers)
            {
                playersEffected += " " + (player != null ? player.Name : "nobody");
            }
        }
        SteamController.LogToConsole(e.NadeType + " that was thrown by " + (e.ThrownBy != null ? e.ThrownBy.Name : "nobody") + " exploded at " + e.Position + " and affected" + playersEffected);
    }
    public void OnEnable()
    {
        m_ControllerInitialized = SteamController.Init();
        print("SteamController.Init() - " + m_ControllerInitialized);
        m_ControllerHandles = new ControllerHandle_t[Constants.STEAM_CONTROLLER_MAX_COUNT];

        if (m_ControllerInitialized)
        {
            Precache();
        }

        // TODO: Activate some default ActionSet?
    }
Beispiel #16
0
 public TaskWrapper GetDownloadOverviewTask(Action onOverviewDownloaded = null)
 {
     if (download2DTask == null)
     {
         download2DTask = SteamController.steamInScene.GenerateMapOverviewDownloadTask(mapName, () =>
         {
             SteamController.LogToConsole("Attempting to download map overview files of " + mapName);
             //status = "Downloading Overview Files";
         }, () =>
         {
             onOverviewDownloaded?.Invoke();
         });
     }
     return(download2DTask);
 }
Beispiel #17
0
 public TaskWrapper GetDownloadDependenciesTask(Action onDependenciesDownloaded = null)
 {
     if (downloadDependenciesTask == null)
     {
         downloadDependenciesTask = SteamController.steamInScene.GenerateDownloadVPKTask(this, () =>
         {
             //status = "Downloading Dependencies";
             SteamController.LogToConsole("Attempting to download dependencies of " + mapName);
         }, () =>
         {
             onDependenciesDownloaded?.Invoke();
         });
     }
     return(downloadDependenciesTask);
 }
    void Precache()
    {
        // ActionSets
        m_ActionSetNames = System.Enum.GetNames(typeof(EActionSets));
        m_nActionSets    = m_ActionSetNames.Length;
        m_ActionSets     = new ControllerActionSetHandle_t[m_nActionSets];

        for (int i = 0; i < m_nActionSets; ++i)
        {
            m_ActionSets[i] = SteamController.GetActionSetHandle(m_ActionSetNames[i]);
            print("SteamController.GetActionSetHandle(" + m_ActionSetNames[i] + ") - " + m_ActionSets[i]);
        }

        // Actions

        // InGameControls Analog Actions
        m_InGameControlsAnalogActionNames = System.Enum.GetNames(typeof(EAnalogActions_InGameControls));
        m_nInGameControlsAnalogActions    = m_InGameControlsAnalogActionNames.Length;
        m_InGameControlsAnalogActions     = new ControllerAnalogActionHandle_t[m_nInGameControlsAnalogActions];

        for (int i = 0; i < m_nInGameControlsAnalogActions; ++i)
        {
            m_InGameControlsAnalogActions[i] = SteamController.GetAnalogActionHandle(m_InGameControlsAnalogActionNames[i]);
            print("SteamController.GetAnalogActionHandle(" + m_InGameControlsAnalogActionNames[i] + ") - " + m_InGameControlsAnalogActions[i]);
        }

        // InGameControls Digital Actions
        m_InGameControlsDigitalActionNames = System.Enum.GetNames(typeof(EDigitalActions_InGameControls));
        m_nInGameControlsDigitalActions    = m_InGameControlsDigitalActionNames.Length;
        m_InGameControlsDigitalActions     = new ControllerDigitalActionHandle_t[m_nInGameControlsDigitalActions];

        for (int i = 0; i < m_nInGameControlsDigitalActions; ++i)
        {
            m_InGameControlsDigitalActions[i] = SteamController.GetDigitalActionHandle(m_InGameControlsDigitalActionNames[i]);
            print("SteamController.GetDigitalActionHandle(" + m_InGameControlsDigitalActionNames[i] + ") - " + m_InGameControlsDigitalActions[i]);
        }

        // MenuControls Digital Actions
        m_MenuControlsDigitalActionNames = System.Enum.GetNames(typeof(EDigitalActions_MenuControls));
        m_nMenuControlsDigitalActions    = m_MenuControlsDigitalActionNames.Length;
        m_MenuControlsDigitalActions     = new ControllerDigitalActionHandle_t[m_nMenuControlsDigitalActions];

        for (int i = 0; i < m_nMenuControlsDigitalActions; ++i)
        {
            m_MenuControlsDigitalActions[i] = SteamController.GetDigitalActionHandle(m_MenuControlsDigitalActionNames[i]);
            print("SteamController.GetDigitalActionHandle(" + m_MenuControlsDigitalActionNames[i] + ") - " + m_MenuControlsDigitalActions[i]);
        }
    }
Beispiel #19
0
    public TaskWrapper GetDownloadMap3DTask(Action onMapDownloaded = null)
    {
        if (download3DTask == null)
        {
            download3DTask = SteamController.steamInScene.GenerateDownloadMapTask(mapName, () =>
            {
                //status = "Downloading Map";
                SteamController.LogToConsole("Attempting to download map file of " + mapName);
            }, () =>
            {
                onMapDownloaded?.Invoke();
            });
        }

        return(download3DTask);
    }
Beispiel #20
0
    void OnDestroy()
    {
        if (!m_bInitialized)
        {
            return;
        }

        if (m_bControllerInitialized)
        {
            bool ret = SteamController.Shutdown();
            if (!ret)
            {
                Debug.LogWarning("SteamController.Shutdown() returned false");
            }
        }

        SteamAPI.Shutdown();
    }
Beispiel #21
0
    /*public void Download3DMapPrompt(Action<bool, ChainedTask> onDecisionMade = null)
     * {
     *  SteamController.ShowPromptPopup(mapName, "Would you like to download the map dependencies as well (textures & models, usually more than 1GB)?", (response) =>
     *  {
     *      var task = TaskMaker.DownloadMap3D(this, response, response, true);
     *      onDecisionMade?.Invoke(response, task);
     *  }, "Yes", "No");
     * }*/

    public void LoadMap2D(bool showMap, bool showControls)
    {
        if (!IsOverviewAvailable())
        {
            if (SteamController.steamInScene.IsLoggedIn)
            {
                map2DChainTask = TaskMaker.DownloadMap2D(this, showMap, showControls);
            }
            else
            {
                SteamController.ShowErrorPopup("Download Error", "You must be logged in to download a map");
            }
        }
        else
        {
            map2DChainTask = TaskMaker.InvokeMapReady2D(this, showMap, showControls);
        }
    }
        private void Startup()
        {
            if (NativeHelpers.Services_GetSteamLoadStatus() == LoadStatus.NotLoaded)
            {
                // Only startup the native parts if they are not loaded yet
                if (!NativeMethods.Services_Startup(Constants.VersionInfo.InterfaceID))
                {
                    // Setup failed!
                    Instance = null;
                    ErrorCodes error = NativeHelpers.Services_GetErrorCode();
                    if (error == ErrorCodes.InvalidInterfaceVersion)
                    {
                        Error.ThrowError(ErrorCodes.InvalidInterfaceVersion,
                                         NativeMethods.Services_GetInterfaceVersion(), Constants.VersionInfo.InterfaceID);
                    }
                    else
                    {
                        Error.ThrowError(error);
                    }
                }
            }

            AppID = new SteamTypes.AppID(NativeMethods.Services_GetAppID());

            serviceJobs = new JobManager();
            serviceJobs.AddJob(new DelegateJob(() => RegisterManagedCallback(), () => RemoveManagedCallback()));
            serviceJobs.AddJob(new DelegateJob(() => cloud              = new Cloud(), () => cloud.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => stats              = new Stats(), () => stats.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => user               = new User(), () => user.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => friends            = new Friends(), () => friends.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => matchmaking        = new MatchMaking(), () => matchmaking.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => matchmakingServers = new MatchmakingServers(), () => matchmakingServers.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => networking         = new Networking(), () => networking.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => utils              = new Utils(), () => utils.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => apps               = new Apps(), () => apps.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => http               = new HTTP(), () => http.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => screenshots        = new Screenshots(), () => screenshots.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => ugc             = new UGC(), () => ugc.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => steamcontroller = new SteamController(), () => steamcontroller.ReleaseManagedResources()));

            hmd = new Hmd();

            serviceJobs.RunCreateJobs();
        }
Beispiel #23
0
    private void CancellableReadDependencies(CancellationToken cancelToken, Action onDependenciesRead = null)
    {
        //status = "Reading Dependencies";
        CreateMapObjectIfNotExist();

        List <string> dependencies = map?.GetDependencies(cancelToken);

        if (!cancelToken.IsCancellationRequested && dependencies != null && dependencies.Count > 0)
        {
            string dependencyList = mapName + " dependencies:\n";
            foreach (string dependency in dependencies)
            {
                dependencyList += dependency + "\n";
            }
            SteamController.LogToConsole(dependencyList);

            dependenciesList = dependencies.ToArray();
        }

        onDependenciesRead?.Invoke();
    }
Beispiel #24
0
 public void LoadMap3D(bool showMap, bool showControls)
 {
     if (!IsMapAvailable())
     {
         if (SteamController.steamInScene.IsLoggedIn)
         {
             map3DChainTask = TaskMaker.DownloadMap3D(this, SettingsController.autoResourcePerMap, SettingsController.autoResourcePerMap, true, showMap, showControls);
         }
         else
         {
             SteamController.ShowErrorPopup("Download Error", "You must be logged in to download a map");
         }
     }
     else if (IsBuilt)
     {
         map3DChainTask = TaskMaker.InvokeMapReady3D(this, showMap, showControls);
     }
     else
     {
         map3DChainTask = TaskMaker.LoadMap(this, showMap, showControls);
     }
 }
 public void Download()
 {
     CancelUpdateChecks();
     if (!IsLoading)
     {
         SettingsController.SaveSettings();
         if (SteamController.steamInScene.IsLoggedIn)
         {
             var paksToDownload = SettingsController.GetTrackedPaks();
             downloadTask = TaskMaker.DownloadFromSteam(paksToDownload);
         }
         else
         {
             SteamController.ShowErrorPopup("Download Error", "You must be logged in to download resources");
         }
     }
     else
     {
         downloadTask.Cancel();
         downloadTask = null;
     }
 }
Beispiel #26
0
    private void MakeGameObject(Action onCompleted = null)
    {
        combine = ramCombine;
        TaskManagerController.RunAction(() =>
        {
            //status = "Building Map";
            SteamController.LogToConsole("Building " + map.mapName);
            map.MakeGameObject(null, (go) =>
            {
                if (combine)
                {
                    MapLoaderController.mapLoaderInScene.combiner.searchOptions.parent = go;
                    MapLoaderController.mapLoaderInScene.combiner.CombineAll();
                }
                else
                {
                    go.SetActive(true);
                }

                onCompleted?.Invoke();
            });
            SteamController.LogToConsole("Finished building " + map.mapName);
        });
    }
Beispiel #27
0
 void DoGetAnalogActionData()
 {
     var     result    = SteamController.GetAnalogActionData((ControllerHandle_t)(ulong)controller.Value, (ControllerAnalogActionHandle_t)(ulong)analogActionHandle.Value);
     Vector2 theResult = new Vector2(result.x, result.y);
 }
 void OnDisable()
 {
     m_ControllerInitialized = false;
     print("SteamController.Shutdown() - " + SteamController.Shutdown());
 }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_ControllerInitialized: " + m_ControllerInitialized);
        GUILayout.Label("m_nControllers: " + m_nControllers);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        if (!m_ControllerInitialized)
        {
            return;
        }

        //SteamController.Shutdown() // Called in OnDisable()

        //SteamController.RunFrame() // N/A - This is called automatically by SteamAPI.RunCallbacks()

        {
            m_nControllers = SteamController.GetConnectedControllers(m_ControllerHandles);
            GUILayout.Label("GetConnectedControllers(m_ControllerHandles) : " + m_nControllers);
        }

        for (int i = 0; i < m_nControllers; ++i)
        {
            GUILayout.Label("Controller " + i + " - " + m_ControllerHandles[i]);

            if (GUILayout.Button("ShowBindingPanel(m_ControllerHandles[i])"))
            {
                bool ret = SteamController.ShowBindingPanel(m_ControllerHandles[i]);
                print("SteamController.ShowBindingPanel(" + m_ControllerHandles[i] + ") : " + ret);
            }

            //SteamController.GetActionSetHandle() // Called in Precache()

            for (int j = 0; j < m_nActionSets; ++j)
            {
                if (GUILayout.Button("ActivateActionSet(m_ControllerHandles[i], m_ActionSets[j])"))
                {
                    SteamController.ActivateActionSet(m_ControllerHandles[i], m_ActionSets[j]);
                    print("SteamController.ActivateActionSet(" + m_ControllerHandles[i] + ", " + m_ActionSets[j] + ")");
                }
            }

            GUILayout.Label("GetCurrentActionSet(m_ControllerHandles[i]) : " + SteamController.GetCurrentActionSet(m_ControllerHandles[i]));

            //SteamController.GetDigitalActionHandle() // Called in Precache()

            GUILayout.Label("InGameControls Digital Actions:");
            for (int j = 0; j < m_nInGameControlsDigitalActions; ++j)
            {
                ControllerDigitalActionData_t ret = SteamController.GetDigitalActionData(m_ControllerHandles[i], m_InGameControlsDigitalActions[j]);
                GUILayout.Label("GetDigitalActionData(" + m_ControllerHandles[i] + ", " + m_InGameControlsDigitalActions[j] + ") - " + ret.bState + " -- " + ret.bActive + " -- " + m_InGameControlsDigitalActionNames[j]);
            }

            GUILayout.Label("MenuControls Digital Actions:");
            for (int j = 0; j < m_nMenuControlsDigitalActions; ++j)
            {
                ControllerDigitalActionData_t ret = SteamController.GetDigitalActionData(m_ControllerHandles[i], m_MenuControlsDigitalActions[j]);
                GUILayout.Label("GetDigitalActionData(" + m_ControllerHandles[i] + ", " + m_MenuControlsDigitalActions[j] + ") - " + ret.bState + " -- " + ret.bActive + " -- " + m_MenuControlsDigitalActionNames[j]);
            }

            if (GUILayout.Button("GetDigitalActionOrigins(m_ControllerHandles[i], m_ActionSets[(int)EActionSets.InGameControls], m_InGameControlsDigitalActions[(int)EDigitalActions_InGameControls.fire], origins)"))
            {
                EControllerActionOrigin[] origins = new EControllerActionOrigin[Constants.STEAM_CONTROLLER_MAX_ORIGINS];
                int ret = SteamController.GetDigitalActionOrigins(m_ControllerHandles[i], m_ActionSets[(int)EActionSets.InGameControls], m_InGameControlsDigitalActions[(int)EDigitalActions_InGameControls.fire], origins);
                print("SteamController.GetDigitalActionOrigins(" + m_ControllerHandles[i] + ", " + m_ActionSets[(int)EActionSets.InGameControls] + ", " + m_InGameControlsDigitalActions[(int)EDigitalActions_InGameControls.fire] + ", " + origins + ") : " + ret);
                print(ret + " origins for: " + m_ActionSetNames[(int)EActionSets.InGameControls] + "::" + m_InGameControlsDigitalActionNames[(int)EDigitalActions_InGameControls.fire]);
                for (int j = 0; j < ret; ++j)
                {
                    print(j + ": " + origins[j]);
                }
            }

            //SteamController.GetAnalogActionHandle() // Called in Precache()

            GUILayout.Label("InGameControls Analog Actions:");
            for (int j = 0; j < m_nInGameControlsAnalogActions; ++j)
            {
                GUILayout.Label("GetAnalogActionData(m_ControllerHandles[i], m_InGameControlsAnalogActions[j]) : " + SteamController.GetAnalogActionData(m_ControllerHandles[i], m_InGameControlsAnalogActions[j]));
            }

            if (GUILayout.Button("GetAnalogActionOrigins(m_ControllerHandles[i], m_ActionSets[(int)EActionSets.InGameControls], m_InGameControlsAnalogActions[(int)EAnalogActions_InGameControls.Throttle], origins)"))
            {
                EControllerActionOrigin[] origins = new EControllerActionOrigin[Constants.STEAM_CONTROLLER_MAX_ORIGINS];
                int ret = SteamController.GetAnalogActionOrigins(m_ControllerHandles[i], m_ActionSets[(int)EActionSets.InGameControls], m_InGameControlsAnalogActions[(int)EAnalogActions_InGameControls.Throttle], origins);
                print("SteamController.GetAnalogActionOrigins(" + m_ControllerHandles[i] + ", " + m_ActionSets[(int)EActionSets.InGameControls] + ", " + m_InGameControlsAnalogActions[(int)EAnalogActions_InGameControls.Throttle] + ", " + origins + ") : " + ret);
                print(ret + " origins for: " + m_ActionSetNames[(int)EActionSets.InGameControls] + "::" + m_InGameControlsAnalogActionNames[(int)EAnalogActions_InGameControls.Throttle]);
                for (int j = 0; j < ret; ++j)
                {
                    print(j + ": " + origins[j]);
                }
            }

            GUILayout.Label("InGameControls Analog Actions:");
            for (int j = 0; j < m_nInGameControlsAnalogActions; ++j)
            {
                if (GUILayout.Button("StopAnalogActionMomentum(m_ControllerHandles[i], m_InGameControlsAnalogActions[j])"))
                {
                    SteamController.StopAnalogActionMomentum(m_ControllerHandles[i], m_InGameControlsAnalogActions[j]);
                    print("SteamController.StopAnalogActionMomentum(" + m_ControllerHandles[i] + ", " + m_InGameControlsAnalogActions[j] + ")");
                }
            }

            if (GUILayout.Button("TriggerHapticPulse(m_ControllerHandles[i], ESteamControllerPad.k_ESteamControllerPad_Right, 5000)"))
            {
                SteamController.TriggerHapticPulse(m_ControllerHandles[i], ESteamControllerPad.k_ESteamControllerPad_Right, 5000);
                print("SteamController.TriggerHapticPulse(" + m_ControllerHandles[i] + ", " + ESteamControllerPad.k_ESteamControllerPad_Right + ", " + 5000 + ")");
            }

            if (GUILayout.Button("TriggerRepeatedHapticPulse(m_ControllerHandles[i], ESteamControllerPad.k_ESteamControllerPad_Right, 5000, 0, 0, 0)"))
            {
                SteamController.TriggerRepeatedHapticPulse(m_ControllerHandles[i], ESteamControllerPad.k_ESteamControllerPad_Right, 5000, 0, 0, 0);
                print("SteamController.TriggerRepeatedHapticPulse(" + m_ControllerHandles[i] + ", " + ESteamControllerPad.k_ESteamControllerPad_Right + ", " + 5000 + ", " + 0 + ", " + 0 + ", " + 0 + ")");
            }

            if (GUILayout.Button("TriggerVibration(m_ControllerHandles[i], ushort.MaxValue, ushort.MaxValue)"))
            {
                SteamController.TriggerVibration(m_ControllerHandles[i], ushort.MaxValue, ushort.MaxValue);
                print("SteamController.TriggerVibration(" + m_ControllerHandles[i] + ", " + ushort.MaxValue + ", " + ushort.MaxValue + ")");
            }

            if (GUILayout.Button("SetLEDColor(m_ControllerHandles[i], 0, 0, 255, (int)ESteamControllerLEDFlag.k_ESteamControllerLEDFlag_SetColor)"))
            {
                SteamController.SetLEDColor(m_ControllerHandles[i], 0, 0, 255, (int)ESteamControllerLEDFlag.k_ESteamControllerLEDFlag_SetColor);
                print("SteamController.SetLEDColor(" + m_ControllerHandles[i] + ", " + 0 + ", " + 0 + ", " + 255 + ", " + (int)ESteamControllerLEDFlag.k_ESteamControllerLEDFlag_SetColor + ")");
            }

            GUILayout.Label("GetGamepadIndexForController(m_ControllerHandles[i]) : " + SteamController.GetGamepadIndexForController(m_ControllerHandles[i]));

            GUILayout.Label("GetControllerForGamepadIndex(0) : " + SteamController.GetControllerForGamepadIndex(0));

            GUILayout.Label("GetMotionData(m_ControllerHandles[i]) : " + SteamController.GetMotionData(m_ControllerHandles[i]));

            if (GUILayout.Button("ShowDigitalActionOrigins(m_ControllerHandles[i], m_InGameControlsDigitalActions[0], 1, 0, 0)"))
            {
                bool ret = SteamController.ShowDigitalActionOrigins(m_ControllerHandles[i], m_InGameControlsDigitalActions[0], 1, 0, 0);
                print("SteamController.ShowDigitalActionOrigins(" + m_ControllerHandles[i] + ", " + m_InGameControlsDigitalActions[0] + ", " + 1 + ", " + 0 + ", " + 0 + ") : " + ret);
            }

            if (GUILayout.Button("ShowAnalogActionOrigins(m_ControllerHandles[i], m_InGameControlsAnalogActions[0], 1, 0, 0)"))
            {
                bool ret = SteamController.ShowAnalogActionOrigins(m_ControllerHandles[i], m_InGameControlsAnalogActions[0], 1, 0, 0);
                print("SteamController.ShowAnalogActionOrigins(" + m_ControllerHandles[i] + ", " + m_InGameControlsAnalogActions[0] + ", " + 1 + ", " + 0 + ", " + 0 + ") : " + ret);
            }
        }

        GUILayout.Label("GetStringForActionOrigin(EControllerActionOrigin.k_EControllerActionOrigin_XBoxOne_A) : " + SteamController.GetStringForActionOrigin(EControllerActionOrigin.k_EControllerActionOrigin_XBoxOne_A));

        GUILayout.Label("GetGlyphForActionOrigin(EControllerActionOrigin.k_EControllerActionOrigin_XBoxOne_A) : " + SteamController.GetGlyphForActionOrigin(EControllerActionOrigin.k_EControllerActionOrigin_XBoxOne_A));

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Beispiel #30
0
        static bool Prefix(
            CameraController __instance,
            float multiplier,

            ref Vector3 ___m_velocity,
            ref Vector2 ___m_angleVelocity,
            ref float ___m_zoomVelocity,

            SavedInputKey ___m_cameraMoveLeft,
            SavedInputKey ___m_cameraMoveRight,
            SavedInputKey ___m_cameraMoveForward,
            SavedInputKey ___m_cameraMoveBackward,

            SavedInputKey ___m_cameraRotateLeft,
            SavedInputKey ___m_cameraRotateRight,
            SavedInputKey ___m_cameraRotateUp,
            SavedInputKey ___m_cameraRotateDown,

            SavedInputKey ___m_cameraZoomAway,
            SavedInputKey ___m_cameraZoomCloser
            )
        {
            if (App.Instance.IsDive)
            {
                return(false);
            }

            var delta        = Vector3.zero;
            var analogAction = SteamController.GetAnalogAction(SteamController.AnalogInput.CameraScroll);

            if (analogAction.sqrMagnitude > 0.0001f)
            {
                delta.x = analogAction.x;
                delta.z = analogAction.y;
                __instance.ClearTarget();
            }

            if (___m_cameraMoveLeft.IsPressed())
            {
                delta.x -= 1f;
                __instance.ClearTarget();
            }
            if (___m_cameraMoveRight.IsPressed())
            {
                delta.x += 1f;
                __instance.ClearTarget();
            }
            if (___m_cameraMoveForward.IsPressed())
            {
                delta.z += 1f;
                __instance.ClearTarget();
            }
            if (___m_cameraMoveBackward.IsPressed())
            {
                delta.z -= 1f;
                __instance.ClearTarget();
            }

            if (__instance.m_analogController)
            {
                float num  = UnityEngine.Input.GetAxis("Horizontal") * __instance.m_GamepadMotionZoomScalar.x;
                float num2 = UnityEngine.Input.GetAxis("Vertical") * __instance.m_GamepadMotionZoomScalar.z;
                if (num != 0f)
                {
                    delta.x = num;
                }
                if (num2 != 0f)
                {
                    delta.z = num2;
                }
            }
            ___m_velocity += delta * multiplier * Time.deltaTime;

            var rotDelta = Vector2.zero;

            if (!__instance.m_freeCamera)
            {
                if (___m_cameraRotateLeft.IsPressed())
                {
                    rotDelta.x += 200f;
                }
                if (___m_cameraRotateRight.IsPressed())
                {
                    rotDelta.x -= 200f;
                }
                if (___m_cameraRotateUp.IsPressed())
                {
                    rotDelta.y += 200f;
                }
                if (___m_cameraRotateDown.IsPressed())
                {
                    rotDelta.y -= 200f;
                }
            }
            ___m_angleVelocity += rotDelta * multiplier * Time.deltaTime;
            float num3 = 0f;

            if (___m_cameraZoomCloser.IsPressed() || SteamController.GetDigitalAction(SteamController.DigitalInput.ZoomIn))
            {
                num3 -= 50f;
            }
            if (___m_cameraZoomAway.IsPressed() || SteamController.GetDigitalAction(SteamController.DigitalInput.ZoomOut))
            {
                num3 += 50f;
            }
            ___m_zoomVelocity += num3 * multiplier * Time.deltaTime;
            return(false);
        }