using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using SGUI;
using TwitchAPI.Polls;
using TwitchIRC;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MTG TwitchAPI")]
[assembly: AssemblyDescription("an api to centralize and simplify twitch communication in the context of ETG modding.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("57445610-0892-47c3-be16-453172104123")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TwitchIRC
{
public class ChatListener
{
public delegate void IrcDelegate(string message);
public delegate void ChatDelegate(string user, string message, string channel);
private const string PRIVATE_STRING = "PRIVMSG";
private string nick;
private string oauth;
private string channel;
private bool listening;
private IrcClient irc;
private Thread readThread;
private Stopwatch pingTimer;
public IrcClient Irc
{
get
{
return irc;
}
set
{
irc = value;
}
}
public bool Connected => irc != null && irc.Connected;
public event IrcDelegate OnRawIrcMessage;
public event ChatDelegate OnChatMessage;
public ChatListener(string nick, string oauth, string channel)
{
this.nick = nick;
this.oauth = oauth;
this.channel = channel.ToLower();
pingTimer = new Stopwatch();
readThread = new Thread(Listen);
}
public bool Connect()
{
try
{
if (!Connected)
{
irc = new IrcClient("irc.twitch.tv", 6667, nick, oauth);
irc.JoinChannel(channel);
}
return irc.Connected;
}
catch (Exception e)
{
Error.Log(e);
}
return false;
}
private void Listen()
{
while (listening)
{
if (!irc.Connected)
{
continue;
}
HandlePings();
string text = irc.ReadMessage();
if (text == null)
{
continue;
}
if (text.StartsWith("PING"))
{
irc.SendIrcMessage("PONG irc.twitch.tv");
}
if (this.OnRawIrcMessage != null)
{
this.OnRawIrcMessage(text);
}
if (text.Contains("PRIVMSG"))
{
string user = text.Substring(1, text.IndexOf('!') - 1);
string s = SplitAtFirst("PRIVMSG", text)[1];
string message = SplitAtFirst(":", s)[1];
if (this.OnChatMessage != null)
{
this.OnChatMessage(user, message, channel);
}
}
}
}
private void HandlePings()
{
if (pingTimer.Elapsed.Seconds > 240)
{
irc.SendIrcMessage("PING irc.twitch.tv");
pingTimer.Reset();
pingTimer.Start();
}
}
private string[] SplitAtFirst(string key, string s)
{
int num = s.IndexOf(key);
if (num == -1)
{
return null;
}
string text = s.Substring(0, num).Trim();
string text2 = s.Substring(num + key.Length).Trim();
return new string[2] { text, text2 };
}
public void StartListening()
{
if (readThread != null && readThread.ThreadState == System.Threading.ThreadState.Unstarted)
{
readThread.Start();
}
pingTimer.Start();
listening = true;
}
public void StopListening()
{
pingTimer.Stop();
pingTimer.Reset();
listening = false;
}
public void ForceStopListening()
{
pingTimer.Stop();
pingTimer.Reset();
readThread.Abort();
listening = false;
}
}
public static class Error
{
public static void Log(Exception e)
{
Console.Error.WriteLine(e.Message + "\n" + e.StackTrace);
}
public static void Log(string s)
{
Console.Error.WriteLine(s);
}
}
public class IrcClient
{
private string userName;
private string channel;
private TcpClient tcpClient;
private StreamReader inputStream;
private StreamWriter outputStream;
public bool Connected => tcpClient.Connected;
public IrcClient(string ip, int port, string userName, string password)
{
try
{
this.userName = userName;
tcpClient = new TcpClient(ip, port);
inputStream = new StreamReader(tcpClient.GetStream());
outputStream = new StreamWriter(tcpClient.GetStream());
SendIrcMessage("PASS " + password);
SendIrcMessage("NICK " + userName);
}
catch (Exception e)
{
Error.Log(e);
}
}
public void JoinChannel(string channel)
{
this.channel = channel;
outputStream.WriteLine("JOIN #" + channel);
outputStream.Flush();
SendIrcMessage("PING irc.twitch.tv");
}
public void SendIrcMessage(string message)
{
try
{
outputStream.WriteLine(message + "\n");
outputStream.Flush();
}
catch (Exception e)
{
Error.Log(e);
}
}
public void SendChatMessage(string message)
{
try
{
SendIrcMessage(":" + userName + "!" + userName + "@" + userName + ".tmi.twitch.tv PRIVMSG #" + channel + " :" + message);
}
catch (Exception e)
{
Error.Log(e);
}
}
public string ReadMessage()
{
try
{
if (tcpClient.GetStream().DataAvailable)
{
return inputStream.ReadLine();
}
}
catch (Exception e)
{
Error.Log(e);
}
return null;
}
public void Close()
{
inputStream.Close();
outputStream.Close();
}
}
}
namespace TwitchAPI
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("panda.etg.twitchAPI", "TWITCHAPI", "1.1.7")]
public class TwitchAPI : BaseUnityPlugin
{
public delegate void ToggleStatusNotification(bool status);
public const string GUID = "panda.etg.twitchAPI";
public const string NAME = "TWITCHAPI";
public const string VERSION = "1.1.7";
public const string TEXT_COLOR = "#6441a5";
private static ConfigFile twitchConfig;
private static ConfigEntry<string> ChannelName;
private static string randomLoginString = "SCHMOOPIE";
private static string anonLoginUser = "justinfan1337";
public static ChatListener.ChatDelegate GlobalChatDelegate;
public static ToggleStatusNotification GlobalToggleStatusNotification;
private static bool integrationEnabled = false;
public static bool hasBeenStarted = false;
public static ChatListener listener = null;
public static TwitchAPI instance;
public static PollUIController ui = null;
private static string logFilePath;
public static bool IntegrationEnabled
{
get
{
return integrationEnabled;
}
set
{
integrationEnabled = value;
GlobalToggleStatusNotification(value);
}
}
public void Start()
{
ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
instance = this;
}
public void GMStart(GameManager g)
{
twitchConfig = ((BaseUnityPlugin)this).Config;
ChannelName = twitchConfig.Bind<string>("TwitchAPI:", "ChannelName", " ", "The name of your channel");
ETGModConsole.Commands.AddGroup("tapi:start", (Action<string[]>)Initilize);
ETGModConsole.Commands.AddGroup("tapi:toggle", (Action<string[]>)ToggleIntegration);
ETGModConsole.Commands.AddGroup("tapi:reload", (Action<string[]>)Reload);
ETGModConsole.Commands.AddGroup("tapi:setchannel", (Action<string[]>)SetChannelName);
((Component)GameManager.Instance).gameObject.AddComponent<PollUIController>();
((Component)GameManager.Instance).gameObject.AddComponent<MainPollController>();
Log("Twitch API 1.1.7 loaded successfully. Type \"tapi:toggle\" to turn it on", "#6441a5");
}
public void DebugTapi(string[] args)
{
}
public static void Log(string text, string color = "#FFFFFF")
{
ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
}
public void Reload(string[] args)
{
((BaseUnityPlugin)this).Config.Reload();
}
public void SetChannelName(string[] args)
{
if (args == null || args.Length == 0 || Utility.IsNullOrWhiteSpace(args[0]))
{
Log("you must enter a channel name");
return;
}
ChannelName.Value = args[0];
((BaseUnityPlugin)this).Config.Reload();
Log("channel name has been set to:" + ChannelName.Value);
}
public void Initilize(string[] args)
{
if (!Utility.IsNullOrWhiteSpace(ChannelName.Value))
{
if (listener == null)
{
listener = new ChatListener(anonLoginUser, randomLoginString, ChannelName.Value);
listener.Connect();
listener.OnChatMessage += ActivateGlobalOnChatMessageDelegate;
listener.StartListening();
}
else if (!listener.Connected)
{
listener.Connect();
}
if (listener.Connected)
{
IntegrationEnabled = true;
}
else
{
ETGModConsole.Log((object)"TwitchAPI had trouble connecting to twitch. Please check the channel name is set properly.", false);
}
}
else
{
Log("Seems as though The config file has not been filled yet.");
Log("You can set your channel name by typing in the console \"tapi:setchannel <channelname>\" ");
Log("Alternatively you can edit your config file via the mod manage and then type in console \"tapi:reload\"");
Log("You should only need to do either of these actions once, unless you want to switch the channel youre joining");
Log("after setting the config, try starting twitch mode again");
}
LogActiveStatus();
}
public void ToggleIntegration(string[] args)
{
if (!IntegrationEnabled && listener != null && listener.Connected)
{
IntegrationEnabled = true;
}
else
{
IntegrationEnabled = false;
}
LogActiveStatus();
}
private void OnApplicationQuit()
{
if (listener != null)
{
listener.StopListening();
}
IntegrationEnabled = false;
}
public static void LogActiveStatus()
{
string text = (IntegrationEnabled ? "<color=#00FF00FF>" : "<color=#FF0000FF>");
string text2 = (IntegrationEnabled ? "enabled" : "disabled");
ETGModConsole.Log((object)("TwitchAPI " + text + text2 + "</color>"), false);
}
private static void ActivationNotification(bool status)
{
}
private static void ActivateGlobalOnChatMessageDelegate(string user, string message, string channel)
{
if (IntegrationEnabled)
{
GlobalChatDelegate(user, message, channel);
}
}
}
}
namespace TwitchAPI.Polls
{
public class MainPollController : MonoBehaviour
{
public static MainPollController instance;
private Queue<Poll> pollQueue = new Queue<Poll>();
private int downTime = 10;
private float downTimer = 0f;
private bool isPollActive = false;
private float pollTimer = 0f;
private int pollTimerInt = 0;
private Poll activePoll = null;
private Dictionary<string, string> Voters = new Dictionary<string, string>();
private void Update()
{
if (pollQueue.Count > 0 && downTimer <= 0f && !isPollActive && TwitchAPI.IntegrationEnabled && !GameManager.Instance.IsFoyer && Object.op_Implicit((Object)(object)GameManager.Instance.PrimaryPlayer) && !GameManager.Instance.IsPaused)
{
ActivatePoll(pollQueue.Dequeue());
}
if (!isPollActive && downTimer >= 0f && !GameManager.Instance.IsPaused)
{
downTimer -= Time.unscaledDeltaTime;
}
if (isPollActive && !GameManager.Instance.IsPaused)
{
pollTimer -= Time.unscaledDeltaTime;
if (pollTimer + 1f < (float)pollTimerInt)
{
pollTimerInt = (int)Math.Floor(pollTimer) + 1;
TwitchAPI.ui.UpdateTimer(pollTimerInt, activePoll.time);
}
if (pollTimer <= 0f)
{
ConcludePoll(activePoll);
}
}
}
private void Start()
{
instance = this;
TwitchAPI.GlobalChatDelegate = (ChatListener.ChatDelegate)Delegate.Combine(TwitchAPI.GlobalChatDelegate, new ChatListener.ChatDelegate(ChatListener));
}
private void ChatListener(string user, string message, string channel)
{
if (isPollActive && !GameManager.Instance.IsPaused)
{
int result = 0;
if (int.TryParse(message, out result) && !Voters.ContainsKey(user))
{
activePoll.options[result - 1].votes++;
Voters.Add(user, message);
TwitchAPI.ui.UpdateVotes(activePoll.options.ToArray());
}
}
}
private void ActivatePoll(Poll poll)
{
activePoll = poll;
pollTimerInt = poll.time;
pollTimer = poll.time;
isPollActive = true;
TwitchAPI.ui.SetOptions(poll.options.ToArray(), poll.title);
TwitchAPI.ui.UpdateVotes(poll.options.ToArray());
TwitchAPI.ui.UpdateTimer(pollTimerInt, poll.time);
TwitchAPI.ui.panelOut = true;
}
private void ConcludePoll(Poll poll)
{
activePoll = null;
pollTimerInt = 0;
pollTimer = 0f;
downTimer = downTime;
isPollActive = false;
TwitchAPI.ui.panelOut = false;
Voters.Clear();
List<VoteOption> winningVotes = FindWinningVotes(poll);
ResolvePoll(poll, winningVotes);
}
public static List<VoteOption> FindWinningVotes(Poll poll)
{
List<VoteOption> list = new List<VoteOption>();
int num = 0;
for (int i = 0; i < poll.options.Count; i++)
{
if (poll.options[i].votes > num)
{
num = poll.options[i].votes;
}
}
for (int j = 0; j < poll.options.Count; j++)
{
if (poll.options[j].votes == num)
{
list.Add(poll.options[j]);
}
}
return list;
}
private void ResolvePoll(Poll poll, List<VoteOption> winningVotes)
{
switch (poll.resolveSettings)
{
case resolvePollOptions.mainOnly:
poll.CallBack();
break;
case resolvePollOptions.randomIfTie:
poll.CallBack();
winningVotes[Random.Range(0, winningVotes.Count)].CallBack();
break;
case resolvePollOptions.noneIfTie:
poll.CallBack();
if (winningVotes.Count == 1)
{
winningVotes[0].CallBack();
}
break;
case resolvePollOptions.AllIfTie:
poll.CallBack();
{
foreach (VoteOption winningVote in winningVotes)
{
winningVote.CallBack();
}
break;
}
default:
poll.CallBack();
break;
}
}
public bool SubmitPoll(Poll poll)
{
if (!TwitchAPI.IntegrationEnabled)
{
return false;
}
if (!VerifyPoll(poll))
{
return false;
}
Poll poll2 = new Poll(poll);
if (!SanitizeInpuPoll(poll2))
{
return false;
}
pollQueue.Enqueue(poll2);
return true;
}
private bool VerifyPoll(Poll poll)
{
if (poll == null)
{
return false;
}
if (poll.options == null || poll.options.Count <= 0)
{
return false;
}
for (int i = 0; i < poll.options.Count; i++)
{
if (Utility.IsNullOrWhiteSpace(poll.options[i].displayText))
{
return false;
}
}
return true;
}
private bool SanitizeInpuPoll(Poll poll)
{
if (!VerifyPoll(poll))
{
return false;
}
if (poll.time > 120)
{
poll.time = 120;
}
if (poll.time < 1)
{
poll.time = 1;
}
if (!Utility.IsNullOrWhiteSpace(poll.title) && poll.title.Length > 50)
{
poll.title = poll.title.Substring(0, 50);
}
while (poll.options.Count > 4)
{
poll.options.RemoveAt(poll.options.Count - 1);
}
foreach (VoteOption option in poll.options)
{
option.votes = 0;
option.displayText.Replace(Environment.NewLine, "");
if (option.displayText.Length >= 50)
{
option.displayText = option.displayText.Substring(0, 50);
}
}
return true;
}
}
public class Poll
{
public resolvePollOptions resolveSettings;
public int time;
public string name;
public string title;
public List<VoteOption> options;
public Action<Poll> callBack = null;
public Poll(int time, List<VoteOption> options, string title, Action<Poll> callBack, resolvePollOptions resolveSettings, string name = null)
{
this.time = time;
if (options != null)
{
this.options = new List<VoteOption>(options);
}
this.name = name;
this.callBack = callBack;
this.resolveSettings = resolveSettings;
this.title = title;
}
public Poll(Poll poll)
{
time = poll.time;
options = new List<VoteOption>();
foreach (VoteOption option in poll.options)
{
options.Add(new VoteOption(option));
}
resolveSettings = poll.resolveSettings;
name = poll.name;
callBack = poll.callBack;
title = poll.title;
}
public void CallBack()
{
if (callBack != null)
{
callBack(this);
}
}
}
public class VoteOption
{
public string displayText;
public int votes;
private Action<VoteOption> callBack = null;
public VoteOption(string displayText, Action<VoteOption> callBack = null)
{
this.displayText = displayText;
this.callBack = callBack;
}
public VoteOption(VoteOption option)
{
displayText = option.displayText;
votes = option.votes;
callBack = option.callBack;
}
public void CallBack()
{
if (callBack != null)
{
callBack(this);
}
}
}
public enum resolvePollOptions
{
mainOnly,
randomIfTie,
noneIfTie,
AllIfTie
}
public class PollUIController : MonoBehaviour
{
private Color bgColor = new Color(0f, 0f, 0f, 0.5f);
private SGroup panel;
private SRect border;
public SLabel itemLabel;
private SLabel votesLabel;
private SLabel timerLabel;
public SLabel debugLabel;
private Font font;
private dfFont gameFont;
private float sizeX;
private float sizeY;
private float startY;
private float extendedY = 10f;
private float lerpSpeed = 3f;
public bool panelOut = false;
public void Start()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
panel = new SGroup();
border = new SRect(new Color(1f, 1f, 1f, 1f));
itemLabel = new SLabel("");
votesLabel = new SLabel("");
timerLabel = new SLabel("");
debugLabel = new SLabel("");
Setup();
((SElement)panel).Children.Add((SElement)(object)border);
((SElement)panel).Children.Add((SElement)(object)itemLabel);
((SElement)panel).Children.Add((SElement)(object)votesLabel);
((SElement)panel).Children.Add((SElement)(object)timerLabel);
((SElement)panel).Position = new Vector2((float)Screen.width / 2f - sizeX / 2f, startY);
SGUIRoot.Main.Children.Add((SElement)(object)panel);
TwitchAPI.ui = this;
}
private void Setup()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
sizeX = 500f;
sizeY = 200f;
startY = 0f - sizeY - 10f;
((SElement)panel).Size = new Vector2(sizeX, sizeY);
((SElement)panel).Background = bgColor;
((SElement)panel).Foreground = Color.clear;
((SElement)panel).Position.y = (float)Screen.height / 2f;
border.Filled = false;
border.Thickness = 3f;
((SElement)border).Size = ((SElement)panel).InnerSize;
((SElement)itemLabel).Background = Color.clear;
((SElement)itemLabel).Foreground = Color.white;
((SElement)itemLabel).Position = new Vector2(0f, 0f);
((SElement)itemLabel).Size = ((SElement)panel).InnerSize;
itemLabel.Alignment = (TextAnchor)3;
((SElement)itemLabel).OnUpdateStyle = delegate(SElement elem)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
elem.Size = ((SElement)panel).InnerSize;
LoadFont();
if ((Object)(object)font != (Object)null)
{
elem.Font = font;
}
};
((SElement)votesLabel).Background = Color.clear;
((SElement)votesLabel).Foreground = Color.white;
((SElement)votesLabel).Position = new Vector2(0f, 0f);
((SElement)votesLabel).Size = new Vector2(((SElement)panel).InnerSize.x * 0.9f, ((SElement)panel).InnerSize.y);
votesLabel.Alignment = (TextAnchor)5;
((SElement)votesLabel).OnUpdateStyle = delegate(SElement elem)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
elem.Size = ((SElement)panel).InnerSize;
LoadFont();
if ((Object)(object)font != (Object)null)
{
elem.Font = font;
}
};
((SElement)timerLabel).Background = Color.clear;
((SElement)timerLabel).Foreground = Color.white;
((SElement)timerLabel).Position = new Vector2(0f, -15f);
((SElement)timerLabel).Size = new Vector2(((SElement)panel).InnerSize.x * 0.9f, ((SElement)panel).InnerSize.y);
timerLabel.Alignment = (TextAnchor)2;
((SElement)timerLabel).OnUpdateStyle = delegate(SElement elem)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
elem.Size = ((SElement)panel).InnerSize;
LoadFont();
if ((Object)(object)font != (Object)null)
{
elem.Font = font;
}
};
}
public void Hide()
{
((SElement)panel).Position.y = startY;
panelOut = false;
}
public void Update()
{
float num = Mathf.InverseLerp(startY, extendedY, ((SElement)panel).Position.y);
float num2 = ((panelOut && !GameManager.Instance.IsPaused) ? (lerpSpeed * Time.unscaledDeltaTime) : ((0f - lerpSpeed) * Time.unscaledDeltaTime));
((SElement)panel).Position.y = Mathf.Lerp(startY, extendedY, num + num2);
}
public void SetOptions(VoteOption[] options, string title = null)
{
if (options != null)
{
string text = string.Empty;
if (!Utility.IsNullOrWhiteSpace(title))
{
text += $" {title}\n";
}
text += $" Vote by typing 1-{options.Length}:\n";
for (int i = 0; i < options.Length; i++)
{
text += $" {i + 1}) {options[i].displayText} \n";
}
itemLabel.Text = text;
}
}
public void UpdateVotes(VoteOption[] votes)
{
if (votes != null)
{
string text = "\n";
int num = itemLabel.Text.Count((char x) => x == '\n');
if (num - votes.Length > 1)
{
text += "\n";
}
for (int i = 0; i < votes.Length; i++)
{
text += $"[{votes[i].votes}] .\n";
}
votesLabel.Text = text;
}
}
public void UpdateTimer(float time, float duration)
{
timerLabel.Text = $"\nTime: {time}/{duration} .";
}
public void LoadFont()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
font = (Font)SGUIRoot.Main.Backend.Font;
}
}
}