using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using Nebula.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Nebula.UI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Nebula.UI")]
[assembly: AssemblyTitle("Nebula.UI")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Nebula.UI;
public class MOTDDatum
{
public string motdPath;
public string motd;
public MOTDDatum(string motd, string motdPath = "WIDGET_MOTD/PANEL_ScrollWindow/010_LABEL_BlockText")
{
this.motd = motd;
this.motdPath = motdPath;
}
}
public class ButtonDatum
{
public UIButton button;
public string menuPath;
public int priority;
public MOTDDatum motdDatum;
public ButtonDatum(UIButton button, string menuPath, int priority, MOTDDatum motdDatum = null)
{
this.button = button;
this.menuPath = menuPath;
this.priority = priority;
this.motdDatum = motdDatum;
}
}
public static class ButtonFactory
{
public static UIButton Create(ButtonFactoryDatum datum)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)((Component)GameObjectUtils.GetMenu(datum.menuPath ?? "")).transform.FindChild(datum.buttonsPath)).gameObject;
return UIFactory.CreateButton(gameObject, datum.buttonSize, datum.name, datum.text, datum.onClick, datum.fontSize, datum.detail.color, datum.detail.font);
}
public static List<UIButton> CreateMultiple(List<ButtonFactoryDatum> data)
{
return new List<UIButton>(LinqSubstitute.Remap<ButtonFactoryDatum, UIButton>((IEnumerable<ButtonFactoryDatum>)data, (Func<ButtonFactoryDatum, UIButton>)Create));
}
}
public class ButtonDetailDatum
{
public Color color;
public Font font;
public ButtonDetailDatum(Color color, Font font = null)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
this.color = color;
this.font = font ?? StockFonts.microgramma["BoldDynamic"];
}
}
public class ButtonFactoryDatum
{
public string name;
public string text;
public List<EventDelegate> onClick;
public int fontSize;
public Vector3 buttonSize;
public string menuPath;
public string buttonsPath;
public ButtonDetailDatum detail;
public ButtonFactoryDatum(string name, string text, List<EventDelegate> onClick, int fontSize, Vector3 buttonSize, string menuPath, string buttonsPath, ButtonDetailDatum detail = null)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
this.name = name;
this.text = text;
this.onClick = onClick;
this.fontSize = fontSize;
this.buttonSize = buttonSize;
this.menuPath = menuPath;
this.buttonsPath = buttonsPath;
this.detail = detail ?? new ButtonDetailDatum(Color.white);
}
}
public class ButtonSpawner
{
private const string type = "ButtonSpawner";
public static Queue<ButtonDatum> buttonQueue = new Queue<ButtonDatum>();
public static void InitQueue()
{
GameObject rootObject = GameObjectUtils.GetRootObject("# CUI_2D");
Transform val = rootObject.transform.FindChild("Camera/ROOT_Menus");
Debug.Log((object)string.Format("{0}: Resolving {1} buttons in queue...", "ButtonSpawner", buttonQueue.Count));
foreach (ButtonDatum item in buttonQueue)
{
Transform val2 = val.FindChild(item.menuPath);
string text = item.priority.ToString().PadLeft(3, '0');
((Object)item.button).name = text + "_" + ((Object)item.button).name;
if (item.motdDatum != null)
{
UILabel component = ((Component)val2.FindChild(item.motdDatum.motdPath)).GetComponent<UILabel>();
((CUIMenu)(object)((Component)val2).GetComponent<CUIMainMenu>()).AddTooltip(component, ((Component)item.button).gameObject, item.motdDatum.motd);
}
}
Debug.Log((object)"ButtonSpawner: Button creation complete.");
buttonQueue.Clear();
}
}
public static class StockFonts
{
public static Dictionary<string, Font> serifGothic = new Dictionary<string, Font>
{
{
"Normal",
LoadFont("SerifGothicStd")
},
{
"Black",
LoadFont("SerifGothicStd-Black")
},
{
"Bold",
LoadFont("SerifGothicStd-Bold")
},
{
"ExtraBold",
LoadFont("SerifGothicStd-ExtraBold")
},
{
"Heavy",
LoadFont("SerifGothicStd-Heavy")
},
{
"Light",
LoadFont("SerifGothicStd-Light")
}
};
public static Dictionary<string, Font> microgramma = new Dictionary<string, Font>
{
{
"Bold",
LoadFont("MicrogrammaExtDBold")
},
{
"BoldDynamic",
LoadFont("MicrogrammaExtDBold_Dynamic")
},
{
"BoldStatic",
LoadFont("MicrogrammaExtDBoldStatic_CockpitHUD")
},
{
"Med",
LoadFont("MicrogrammaExtDMed")
},
{
"MedDynamic",
LoadFont("MicrogrammaExtDMed_Dynamic")
},
{
"MedStatic",
LoadFont("MicrogrammaExtDMedStatic_CockpitHUD")
}
};
private static Font LoadFont(string fontName)
{
return Resources.Load<Font>("ui/fonts/" + fontName);
}
}
public static class UIFactory
{
public static UILabel CreateLabel(this GameObject root, string name, string text, Color color, int fontSize, int width, Font ttf = null, Effect effect = 1)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
UILabel val = NGUITools.AddChild<UILabel>(root);
((Object)val).name = "LABEL_" + name;
val.text = text;
val.effectStyle = effect;
((UIWidget)val).color = color;
((UIWidget)val).height = fontSize;
((UIWidget)val).width = width;
val.overflowMethod = (Overflow)2;
((UIWidget)val).pivot = (Pivot)5;
((Component)val).transform.localPosition = Vector3.zero;
val.trueTypeFont = ttf ?? StockFonts.microgramma["BoldDynamic"];
val.fontSize = fontSize;
return val;
}
public static UITexture CreateTextureBackground(this GameObject root, Color fromColor, int width, int height)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
Texture2D mainTexture = Resources.Load<Texture2D>("ui/ngui/textures/fill_64x");
UITexture val = NGUITools.AddChild<UITexture>(root);
((Object)val).name = "TEXTURE_Background";
((UIWidget)val).mainTexture = (Texture)(object)mainTexture;
((UIWidget)val).color = Color.clear;
((UIWidget)val).pivot = (Pivot)5;
((Component)val).transform.localPosition = new Vector3(16f, 0f, 0f);
((UIWidget)val).width = width;
((UIWidget)val).height = height;
((UIWidget)val).depth = -1;
TweenColor val2 = ((Component)val).gameObject.AddComponent<TweenColor>();
val2.from = fromColor;
val2.to = Color.clear;
((UITweener)val2).duration = 0.01f;
return val;
}
public static UIButton CreateButton(GameObject root, Vector3 size, string name, string text, List<EventDelegate> onClick, int fontSize, Color color, Font ttf = null)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
GameObject val = NGUITools.AddChild(root);
((Object)val).name = "BUTTON_" + name;
BoxCollider val2 = val.AddComponent<BoxCollider>();
val2.size = size;
val2.center = new Vector3((0f - size.x) / 2f, 2f, 0f);
UIButton val3 = val.AddComponent<UIButton>();
val3.onClick = onClick;
((UIButtonColor)val3).hover = new Color(0.7686f, 0.1804f, 0f);
((UIButtonColor)val3).pressed = new Color(0.7725f, 0.1808f, 0f);
((UIButtonColor)val3).duration = 0.01f;
CUIButtonInput val4 = val.AddComponent<CUIButtonInput>();
val4.inputType = (InputType)0;
val4.sendsOnClickOnConfirm = true;
CUIMenuAudioTrigger val5 = val.AddComponent<CUIMenuAudioTrigger>();
val5.clipType = (AudioClipType)0;
val5.trigger = (Trigger)1;
val.CreateLabel("Button", text, color, fontSize, (int)size.x, ttf, (Effect)1);
UITexture val6 = val.CreateTextureBackground(((UIButtonColor)val3).hover, (int)size.x, (int)size.y);
((UIButtonColor)val3).tweenTarget = ((Component)val6).gameObject;
return val3;
}
public static CUIButtonTooltip AddTooltip(this CUIMenu menu, UILabel label, GameObject target, string text)
{
CUIButtonTooltip val = ((Component)menu).gameObject.AddComponent<CUIButtonTooltip>();
val.label = label;
val.target = target;
val.text = text;
return val;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Nebula.UI";
public const string PLUGIN_NAME = "Nebula.UI";
public const string PLUGIN_VERSION = "1.0.0";
}