private static RadialCell CreateChildCell(uGUI_CraftNode node, RadialCell parent) { var siblings = node.parent.childCount; var size = ComputeNewSize(parent); var radius = ComputeNewRadius(parent, size); var maxSiblings = GetPolygonLineCount(radius, size); var index = uGUI_CraftNodeReflector.GetIndex(node); if (siblings > maxSiblings) { size = GetPolygonLineSize(radius, siblings); var angleDelta1 = 2 * Mathf.PI / siblings; var angle1 = angleDelta1 * index + GetExtraAngleOffset(siblings); return(new RadialCell(radius, angle1, size, float.NaN, siblings, parent)); } var angleDelta = 2 * Mathf.PI / maxSiblings; var groupAngle = siblings > parent.siblings ? parent.groupAngle : parent.angle; if (float.IsNaN(groupAngle)) { groupAngle = parent.angle; } var angle = groupAngle + angleDelta * (index - (siblings - 1) / 2.0f); return(new RadialCell(radius, angle, size, groupAngle, siblings, parent)); }
private static RadialCell CreateChildCell(uGUI_CraftNode node, RadialCell parent) { int childCount = ((TreeNode)node).get_parent().get_childCount(); float newSize = RadialCell.ComputeNewSize(parent); float newRadius = RadialCell.ComputeNewRadius(parent, newSize); float polygonLineCount = RadialCell.GetPolygonLineCount(newRadius, newSize); int index = uGUI_CraftNodeReflector.GetIndex(node); if ((double)childCount > (double)polygonLineCount) { float polygonLineSize = RadialCell.GetPolygonLineSize(newRadius, (float)childCount); float angle = 6.283185f / (float)childCount * (float)index + RadialCell.GetExtraAngleOffset(childCount); return(new RadialCell(newRadius, angle, polygonLineSize, float.NaN, childCount, parent)); } float num1 = 6.283185f / polygonLineCount; float num2 = childCount > parent.siblings ? parent.groupAngle : parent.angle; if (float.IsNaN(num2)) { num2 = parent.angle; } float angle1 = num2 + num1 * ((float)index - (float)(childCount - 1) / 2f); return(new RadialCell(newRadius, angle1, newSize, num2, childCount, parent)); }
public static int GetIndex(uGUI_CraftNode node) { if (node == null) { throw new ArgumentNullException("node is null"); } return((int)indexPropertyInfo.GetValue(node, null)); }
public static uGUI_CraftingMenu GetView(uGUI_CraftNode node) { if (node == null) { throw new ArgumentNullException("node is null"); } return((uGUI_CraftingMenu)uGUI_CraftNodeReflector.viewFieldInfo.GetValue((object)node)); }
public static void SetCraftedNode(uGUI_CraftingMenu menu, uGUI_CraftNode craftedNode) { if (Object.op_Equality((Object)menu, (Object)null)) { throw new ArgumentNullException("menu is null"); } uGUI_CraftingMenuReflector.craftedNodeFieldInfo.SetValue((object)menu, (object)craftedNode); }
public static int GetIndex(uGUI_CraftNode node) { if (node == null) { throw new ArgumentNullException("node is null"); } return((int)uGUI_CraftNodeReflector.indexPropertyInfo.GetValue((object)node, (object[])null)); }
public static bool GetVisible(uGUI_CraftNode node) { if (node == null) { throw new ArgumentNullException("node is null"); } return((bool)uGUI_CraftNodeReflector.visiblePropertyInfo.GetValue((object)node, (object[])null)); }
public static bool IsLockedInHierarchy(uGUI_CraftNode node) { if (node == null) { throw new ArgumentNullException("node is null"); } return((bool)isLockedInHierarchyMethodInfo.Invoke(node, null)); }
// Token: 0x06000017 RID: 23 RVA: 0x00002498 File Offset: 0x00000698 public static void SetCraftedNode(uGUI_CraftingMenu menu, uGUI_CraftNode craftedNode) { if (menu == null) { throw new ArgumentNullException("menu is null"); } uGUI_CraftingMenuReflector.craftedNodeFieldInfo.SetValue(menu, craftedNode); }
public static bool GetVisible(uGUI_CraftNode node) { if (node == null) { throw new ArgumentNullException("node is null"); } return((bool)visiblePropertyInfo.GetValue(node, null)); }
public static void SetNodeChroma(uGUI_CraftNode node, bool enabled) { if (!node.icon) { return; } node.icon.SetForegroundChroma(enabled ? 1 : 0); node.icon.SetBackgroundChroma(enabled ? 1 : .2f); }
private static void ForeachChildRecursively(uGUI_CraftNode node, Action <uGUI_CraftNode> action) { if (node == null) { return; } foreach (var child in node) { action(child); ForeachChildRecursively(child, action); } }
private static void Postfix(uGUI_CraftNode __instance) { if (Object.op_Equality((Object)__instance.get_icon(), (Object)null)) { return; } RadialCell radialCell = RadialCell.Create(__instance); Vector2 targetPosition = uGUI_CraftNodeReflector.GetVisible(__instance) ? radialCell.Position : radialCell.parent.Position; GhostMoving ghostMoving = new GhostMoving((radialCell.radius + radialCell.size) * (float)Config.AnimationSpeedMult, radialCell.size * (float)Config.AnimationFadeDistanceMult, targetPosition); ItemIconAnimation.Play(__instance.get_icon(), (ItemIconAnimation)ghostMoving); }
private static void Postfix(uGUI_CraftNode __instance) { if (!Active) { return; } if (uGUI_CraftNodeReflector.GetView(__instance) != CurrentMenu) { return; } GUIFormatter.PaintNodeColor(__instance); }
public static void PaintNodeColor(uGUI_CraftNode node) { if (node.action == TreeAction.Expand) { Color color = new Color(Config.SliderValueR / 255, Config.SliderValueG / 255, Config.SliderValueB / 255, Config.alpha / 255); Main.GUIFormatter.SetIconColors(node.icon, frontColor, color); } else if (node.action == TreeAction.Craft) { Color color = new Color(Config.SliderValueR1 / 255, Config.SliderValueG1 / 255, Config.SliderValueB1 / 255, Config.alpha / 255); Main.GUIFormatter.SetIconColors(node.icon, frontColor, color); } }
private static void Postfix(uGUI_CraftingMenu __instance, uGUI_CraftNode sender) { ITreeActionReceiver client = uGUI_CraftingMenuReflector.GetClient(__instance); bool interactable = uGUI_CraftingMenuReflector.GetInteractable(__instance); if (client != null && interactable && __instance.ActionAvailable(sender) || Object.op_Equality((Object)sender.get_icon(), (Object)null)) { return; } float num = 1f + Random.Range(-0.2f, 0.2f); sender.get_icon().PunchScale(5f, 0.5f, num, 0.0f); }
// Token: 0x06000056 RID: 86 RVA: 0x00002F40 File Offset: 0x00001140 private static void Postfix(uGUI_CraftNode __instance) { if (__instance.icon == null) { return; } RadialCell radialCell = RadialCell.Create(__instance); Vector2 targetPosition = uGUI_CraftNodeReflector.GetVisible(__instance) ? radialCell.Position : radialCell.parent.Position; float speed = (radialCell.radius + radialCell.size) * (float)Config.AnimationSpeedMult; float fadeDistance = radialCell.size * (float)Config.AnimationFadeDistanceMult; GhostMoving newAnimation = new GhostMoving(speed, fadeDistance, targetPosition); ItemIconAnimation.Play(__instance.icon, newAnimation); }
private static void Postfix(uGUI_CraftNode __instance) { if (__instance.icon == null) { return; } var grid = RadialCell.Create(__instance); var pos = __instance.visible ? grid.Position : grid.parent.Position; var speed = (grid.radius + grid.size) * (float)Config.AnimationSpeedMult; var fadeDistance = grid.size * (float)Config.AnimationFadeDistanceMult; var anim = new IconMovingAnimation(speed, fadeDistance, pos); anim.Play(__instance.icon); }
public static RadialCell Create(uGUI_CraftNode node) { if (((TreeNode)node).get_parent() == null) { return(RadialCell.InvalidCell); } RadialCell parent = RadialCell.Create(((TreeNode)node).get_parent() as uGUI_CraftNode); if (parent == RadialCell.InvalidCell) { return(RadialCell.CreateRootCell(node)); } return((double)parent.radius != 0.0 ? RadialCell.CreateChildCell(node, parent) : RadialCell.CreateChildCellWithOneElementAtRoot(node, parent)); }
private static void Postfix(uGUI_CraftNode __instance) { var grid = RadialCell.Create(__instance); var icon = __instance.icon; var size = new Vector2(grid.size, grid.size); icon.SetBackgroundSize(size); icon.SetActiveSize(size); var foregroundSize = grid.size * (float)Config.IconForegroundSizeMult; icon.SetForegroundSize(foregroundSize, foregroundSize, true); icon.SetBackgroundRadius(grid.size / 2); icon.rectTransform.SetParent(__instance.view.iconsCanvas); icon.SetPosition(grid.parent.Position); }
private static void Postfix(uGUI_CraftNode __instance) { RadialCell radialCell = RadialCell.Create(__instance); var icon = __instance.icon; var vector = new Vector2(radialCell.size, radialCell.size); icon.SetBackgroundSize(vector); icon.SetActiveSize(vector); float num = radialCell.size * (float)Config.IconForegroundSizeMult; icon.SetForegroundSize(num, num, true); icon.SetBackgroundRadius(radialCell.size / 2f); icon.rectTransform.SetParent(uGUI_CraftNodeReflector.GetView(__instance).iconsCanvas); icon.SetPosition(radialCell.parent.Position); }
private static void Postfix(uGUI_CraftingMenu __instance, uGUI_CraftNode sender) { var client = __instance.client; var interactable = __instance.interactable; if (client == null || !interactable || !__instance.ActionAvailable(sender)) { if (sender.icon == null) { return; } var duration = 1 + Random.Range(-0.2f, 0.2f); sender.icon.PunchScale(5, 0.5f, duration, 0); } }
// Token: 0x0600004D RID: 77 RVA: 0x00002DE8 File Offset: 0x00000FE8 private static void Postfix(uGUI_CraftingMenu __instance, uGUI_CraftNode sender) { bool client = uGUI_CraftingMenuReflector.GetClient(__instance) != null; bool interactable = uGUI_CraftingMenuReflector.GetInteractable(__instance); if (!client || !interactable || !__instance.ActionAvailable(sender)) { if (sender.icon == null) { return; } float duration = 1f + UnityEngine.Random.Range(-0.2f, 0.2f); sender.icon.PunchScale(5f, 0.5f, duration, 0f); } }
private static void ReplaceNodeTech(uGUI_CraftNode node) { if (node.action != TreeAction.Craft) { return; } TechType recyclingTech; if (RecyclingData.TryGet(node.techType0, out recyclingTech)) { replacedNodeTechs[node] = node.techType0; node.techType0 = recyclingTech; } }
private static void Postfix(uGUI_CraftNode __instance) { RadialCell radialCell = RadialCell.Create(__instance); uGUI_ItemIcon icon = __instance.get_icon(); Vector2 vector2; ((Vector2) ref vector2).\u002Ector(radialCell.size, radialCell.size); icon.SetBackgroundSize(vector2); icon.SetActiveSize(vector2); float num = radialCell.size * (float)Config.IconForegroundSizeMult; icon.SetForegroundSize(num, num, true); icon.SetBackgroundRadius(radialCell.size / 2f); ((Transform)((Graphic)icon).get_rectTransform()).SetParent((Transform)uGUI_CraftNodeReflector.GetView(__instance).iconsCanvas); icon.SetPosition(radialCell.parent.Position); }
public static RadialCell Create(uGUI_CraftNode node) { if (node.parent == null) { return(InvalidCell); } var parentCell = Create(node.parent as uGUI_CraftNode); if (parentCell == InvalidCell) { return(CreateRootCell(node)); } return(parentCell.radius == 0 ? CreateChildCellWithOneElementAtRoot(node, parentCell) : CreateChildCell(node, parentCell)); }
private static void Postfix(uGUI_CraftNode __instance, bool available) { if (!Active) { return; } if (uGUI_CraftNodeReflector.GetView(__instance) != CurrentMenu) { return; } if (uGUI_CraftNodeReflector.GetVisible(__instance)) { var enabled = available && !uGUI_CraftNodeReflector.IsLockedInHierarchy(__instance); GUIFormatter.SetNodeChroma(__instance, enabled); } }
private static RadialCell CreateChildCellWithOneElementAtRoot(uGUI_CraftNode node, RadialCell parent) { var siblings = node.parent.childCount; var size = ComputeNewSize(parent); var radius = ComputeNewRadius(parent, size); var index = uGUI_CraftNodeReflector.GetIndex(node); var maxSiblings = GetPolygonLineCount(radius, size); if (siblings > maxSiblings) { size = GetPolygonLineSize(radius, siblings); } var angleDelta = 2 * Mathf.PI / siblings; var angle = angleDelta * index + GetExtraAngleOffset(siblings); return(new RadialCell(radius, angle, size, float.NaN, siblings, parent)); }
private static RadialCell CreateChildCellWithOneElementAtRoot( uGUI_CraftNode node, RadialCell parent) { int childCount = ((TreeNode)node).get_parent().get_childCount(); float num = RadialCell.ComputeNewSize(parent); float newRadius = RadialCell.ComputeNewRadius(parent, num); int index = uGUI_CraftNodeReflector.GetIndex(node); float polygonLineCount = RadialCell.GetPolygonLineCount(newRadius, num); if ((double)childCount > (double)polygonLineCount) { num = RadialCell.GetPolygonLineSize(newRadius, (float)childCount); } float angle = 6.283185f / (float)childCount * (float)index + RadialCell.GetExtraAngleOffset(childCount); return(new RadialCell(newRadius, angle, num, float.NaN, childCount, parent)); }
//protected void CreateIcon() public static void CreateIcon_Postfix(uGUI_CraftNode __instance) { if (_view != null && __instance.action == TreeAction.Expand) { var cm = (uGUI_CraftingMenu)_view.GetValue(__instance); if (cm != null && __instance.icon != null) { // If current node belongs to one of our custom fabricators if (cm.id == "DecorationsFabricator" && DecorationNodes.Contains(__instance.id)) { __instance.icon.SetBackgroundColors(DNormal, DHover, DPressed); } else if (cm.id == "FloraFabricator" && FloraNodes.Contains(__instance.id)) { __instance.icon.SetBackgroundColors(FNormal, FHover, FPressed); } } } }