RAGECOOP-V/docs/api/RageCoop.Client.Scripting.API.html
2022-07-01 17:00:42 +08:00

493 lines
20 KiB
HTML

<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class API
| RageCoop resource documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class API
| RageCoop resource documentation ">
<meta name="generator" content="docfx 2.59.2.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
<meta property="docfx:rel" content="../">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list">Search Results for <span></span></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="RageCoop.Client.Scripting.API">
<h1 id="RageCoop_Client_Scripting_API" data-uid="RageCoop.Client.Scripting.API" class="text-break">Class API
</h1>
<div class="markdown level0 summary"><p>Provides vital functionality to interact with RAGECOOP</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></div>
<div class="level1"><span class="xref">API</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.tostring#system-object-tostring">Object.ToString()</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">Object.Equals(Object)</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">Object.Equals(Object, Object)</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.referenceequals#system-object-referenceequals(system-object-system-object)">Object.ReferenceEquals(Object, Object)</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gethashcode#system-object-gethashcode">Object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gettype#system-object-gettype">Object.GetType()</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.memberwiseclone#system-object-memberwiseclone">Object.MemberwiseClone()</a>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="RageCoop.Client.Scripting.html">RageCoop.Client.Scripting</a></h6>
<h6><strong>Assembly</strong>: RageCoop.Client.dll</h6>
<h5 id="RageCoop_Client_Scripting_API_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static class API</code></pre>
</div>
<h3 id="properties">Properties
</h3>
<a id="RageCoop_Client_Scripting_API_CurrentVersion_" data-uid="RageCoop.Client.Scripting.API.CurrentVersion*"></a>
<h4 id="RageCoop_Client_Scripting_API_CurrentVersion" data-uid="RageCoop.Client.Scripting.API.CurrentVersion">CurrentVersion</h4>
<div class="markdown level1 summary"><p>Get the version of RAGECOOP</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string CurrentVersion { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_IsChatFocused_" data-uid="RageCoop.Client.Scripting.API.IsChatFocused*"></a>
<h4 id="RageCoop_Client_Scripting_API_IsChatFocused" data-uid="RageCoop.Client.Scripting.API.IsChatFocused">IsChatFocused</h4>
<div class="markdown level1 summary"><p>Check if the RAGECOOP chat is visible</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool IsChatFocused { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_IsMenuVisible_" data-uid="RageCoop.Client.Scripting.API.IsMenuVisible*"></a>
<h4 id="RageCoop_Client_Scripting_API_IsMenuVisible" data-uid="RageCoop.Client.Scripting.API.IsMenuVisible">IsMenuVisible</h4>
<div class="markdown level1 summary"><p>Check if a RAGECOOP menu is visible</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool IsMenuVisible { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_IsOnServer_" data-uid="RageCoop.Client.Scripting.API.IsOnServer*"></a>
<h4 id="RageCoop_Client_Scripting_API_IsOnServer" data-uid="RageCoop.Client.Scripting.API.IsOnServer">IsOnServer</h4>
<div class="markdown level1 summary"><p>Check if the player is already on a server</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool IsOnServer { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_IsPlayerListVisible_" data-uid="RageCoop.Client.Scripting.API.IsPlayerListVisible*"></a>
<h4 id="RageCoop_Client_Scripting_API_IsPlayerListVisible" data-uid="RageCoop.Client.Scripting.API.IsPlayerListVisible">IsPlayerListVisible</h4>
<div class="markdown level1 summary"><p>Check if the RAGECOOP list of players is visible</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool IsPlayerListVisible { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_LocalPlayerID_" data-uid="RageCoop.Client.Scripting.API.LocalPlayerID*"></a>
<h4 id="RageCoop_Client_Scripting_API_LocalPlayerID" data-uid="RageCoop.Client.Scripting.API.LocalPlayerID">LocalPlayerID</h4>
<div class="markdown level1 summary"><p>Get the local player's ID</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int LocalPlayerID { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
<td><p>PlayerID</p>
</td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<a id="RageCoop_Client_Scripting_API_Disconnect_" data-uid="RageCoop.Client.Scripting.API.Disconnect*"></a>
<h4 id="RageCoop_Client_Scripting_API_Disconnect" data-uid="RageCoop.Client.Scripting.API.Disconnect">Disconnect()</h4>
<div class="markdown level1 summary"><p>Disconnect from the server</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void Disconnect()</code></pre>
</div>
<a id="RageCoop_Client_Scripting_API_GetLogger_" data-uid="RageCoop.Client.Scripting.API.GetLogger*"></a>
<h4 id="RageCoop_Client_Scripting_API_GetLogger" data-uid="RageCoop.Client.Scripting.API.GetLogger">GetLogger()</h4>
<div class="markdown level1 summary"><p>Get a <a class="xref" href="RageCoop.Core.Logger.html">Logger</a> that RAGECOOP is currently using.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Logger GetLogger()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="RageCoop.Core.Logger.html">Logger</a></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_LocalChatMessage_" data-uid="RageCoop.Client.Scripting.API.LocalChatMessage*"></a>
<h4 id="RageCoop_Client_Scripting_API_LocalChatMessage_System_String_System_String_" data-uid="RageCoop.Client.Scripting.API.LocalChatMessage(System.String,System.String)">LocalChatMessage(String, String)</h4>
<div class="markdown level1 summary"><p>Send a local chat message to this player</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void LocalChatMessage(string from, string message)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
<td><span class="parametername">from</span></td>
<td><p>Name of the sender</p>
</td>
</tr>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.string">String</a></td>
<td><span class="parametername">message</span></td>
<td><p>The player's message</p>
</td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_QueueAction_" data-uid="RageCoop.Client.Scripting.API.QueueAction*"></a>
<h4 id="RageCoop_Client_Scripting_API_QueueAction_System_Action_" data-uid="RageCoop.Client.Scripting.API.QueueAction(System.Action)">QueueAction(Action)</h4>
<div class="markdown level1 summary"><p>Queue an action to be executed on next tick.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void QueueAction(Action a)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action">Action</a></td>
<td><span class="parametername">a</span></td>
<td></td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_RegisterCustomEventHandler_" data-uid="RageCoop.Client.Scripting.API.RegisterCustomEventHandler*"></a>
<h4 id="RageCoop_Client_Scripting_API_RegisterCustomEventHandler_System_Int32_System_Action_RageCoop_Client_Scripting_CustomEventReceivedArgs__" data-uid="RageCoop.Client.Scripting.API.RegisterCustomEventHandler(System.Int32,System.Action{RageCoop.Client.Scripting.CustomEventReceivedArgs})">RegisterCustomEventHandler(Int32, Action&lt;CustomEventReceivedArgs&gt;)</h4>
<div class="markdown level1 summary"><p>Register an handler to the specifed event hash, one event can have multiple handlers. This will be invoked from backgound thread, use <a class="xref" href="RageCoop.Client.Scripting.API.html#RageCoop_Client_Scripting_API_QueueAction_System_Action_">QueueAction(Action)</a> in the handler to dispatch code to script thread.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void RegisterCustomEventHandler(int hash, Action&lt;CustomEventReceivedArgs&gt; handler)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
<td><span class="parametername">hash</span></td>
<td><p>An unique identifier of the event, you can hash your event name with <a class="xref" href="RageCoop.Core.Scripting.CustomEvents.html#RageCoop_Core_Scripting_CustomEvents_Hash_System_String_">Hash(String)</a></p>
</td>
</tr>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.action-1">Action</a>&lt;<a class="xref" href="RageCoop.Client.Scripting.CustomEventReceivedArgs.html">CustomEventReceivedArgs</a>&gt;</td>
<td><span class="parametername">handler</span></td>
<td><p>An handler to be invoked when the event is received from the server.</p>
</td>
</tr>
</tbody>
</table>
<a id="RageCoop_Client_Scripting_API_SendCustomEvent_" data-uid="RageCoop.Client.Scripting.API.SendCustomEvent*"></a>
<h4 id="RageCoop_Client_Scripting_API_SendCustomEvent_System_Int32_System_Collections_Generic_List_System_Object__" data-uid="RageCoop.Client.Scripting.API.SendCustomEvent(System.Int32,System.Collections.Generic.List{System.Object})">SendCustomEvent(Int32, List&lt;Object&gt;)</h4>
<div class="markdown level1 summary"><p>Send an event and data to the specified clients.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void SendCustomEvent(int eventHash, List&lt;object&gt; args)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.int32">Int32</a></td>
<td><span class="parametername">eventHash</span></td>
<td><p>An unique identifier of the event</p>
</td>
</tr>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a>&gt;</td>
<td><span class="parametername">args</span></td>
<td><p>The objects conataing your data, supported types:
byte, short, ushort, int, uint, long, ulong, float, bool, string.</p>
</td>
</tr>
</tbody>
</table>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<h5>In This Article</h5>
<div></div>
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>