public Gather(ResourceNodeType type, ItemType output, List <ItemType> input, float duration) { Type = type; Output = output; Input = input; Duration = duration; }
public ResourceNodeBase(string name, Point size, Texture2D texture, ResourceNodeType resourceNodeType) { Name = name; Size = size; Texture = texture; ResourceNodeType = resourceNodeType; }
public ResourceNode(Game game, NodeList subNode, String name, ResourceNodeType type = ResourceNodeType.MESH) { m_game = game; m_subNodes = subNode; m_name = name; m_type = type; }
public ResourceNode GetRandomResourceNode(ResourceNodeType nodeType) { ResourceNode rn = null; List <ResourceNodeDataElement> thisList = new List <ResourceNodeDataElement>(); switch (nodeType) { default: thisList = allTreeResourceNodes; break; } int chanceSum = 0; for (int i = 0; i < thisList.Count; i++) { chanceSum += thisList[i].chance; } int randomiser = Random.Range(0, chanceSum + 1); int checkSum = 0; for (int i = 0; i < thisList.Count; i++) { if (randomiser <= thisList[i].chance) { rn = thisList[i].thisNode; break; } else { checkSum += thisList[i].chance; } } return(rn); }
/* RESOURCE { name = Antimatter storagecapacity = unlimited (ToDo) storedamount = 10.00 supply_mode = 1 value_factor = 1 display_order = 3 hide = 0 group = none } */ internal void ResourceRow(ResourceNodeType node, List<bool> _expanded, int counter, int TotalNumbr) { int this_id = counter; int last_id = counter-1; int next_id = counter+1; string res_nam = node.name; //Debug.Log("ResourceRecovery: ResourceRow: res_nam=" + res_nam + " this_id=" + this_id + " last_id=" + last_id + " next_id=" + next_id); GUILayout.BeginHorizontal(); if (last_id >= 0) { if (GUILayout.Button("↑", style_10px_row)) { Debug.Log("ResourceRecorvery: ResourceRow() Clicked Button R:" + res_nam + " : up"); change_order(res_nam, this_id, last_id); } } else { GUILayout.Label("", style_10px_row); } if (last_id < TotalNumbr) { if (GUILayout.Button("↓", style_10px_row)) { Debug.Log("ResourceRecorvery: ResourceRow() Clicked Button R:" + res_nam + " : down"); change_order(res_nam,this_id, next_id); } } else { GUILayout.Label("", style_10px_row); } GUILayout.Label(String.Format("{0}", res_nam + " (" + node.display_order + ")"), style_stretchWidth_row); if (node.supply_mode!="0") { double string_number0 = 0; if (double.TryParse(node.storedamount, out string_number0)) { GUILayout.Label(String.Format("{0}", Math.Round(string_number0, 2)), style_100px_row); } else { GUILayout.Label(String.Format("{0}", node.storedamount), style_100px_row); } } else { GUILayout.Label(String.Format("{0}", RRSettingsController.get_resource_supply_mode_definition(0)), style_100px_row); } /* int string_number = 0; if (Int32.TryParse(node.supply_mode, out string_number)) { GUILayout.Label(String.Format("{0}", RRSettingsController.get_resource_supply_mode_definition(string_number)), style_80px_row); } else { GUILayout.Label(String.Format("{0}", node.supply_mode), style_80px_row); } GUILayout.Label(String.Format("{0}", node.value_factor), style_80px_row); */ if (GUILayout.Button(node.group, RRSettingsController.get_button_80px())) { Debug.Log("Clicked Button = change Group" + res_nam); changeGroup(res_nam, node.group); } //GUILayout.Label(String.Format("{0}", node.group), style_80px_row); if (GUILayout.Button("Hide/Unhide", buttonStyle)) { Debug.Log("Clicked Button = Hide/Unhide" + res_nam); change_hidden_status(res_nam, node.hide); } int string_number2 = 0; if (Int32.TryParse(node.hide, out string_number2)) { GUILayout.Label(String.Format("{0}", Utilities.bool_int_to_string(string_number2, true)), style_80px_row); } else { GUILayout.Label(String.Format("{0}", node.hide), style_80px_row); } if (GUILayout.Button("Dump All", buttonStyle)) { Debug.Log("Clicked Button = Dump All" + res_nam); DumpResource(res_nam); } if (GUILayout.Button("FooBar", buttonStyle)) { Debug.Log("Clicked Button = FooBar" + res_nam); DEBUG_FillResource(res_nam, node.storedamount); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(splitter);GUILayout.EndHorizontal(); }
/* RESOURCE { name = Antimatter storagecapacity = unlimited (ToDo) storedamount = 10.00 supply_mode = 1 value_factor = 1 display_order = 3 hide = 0 group = none } */ internal void ResourceRow(ResourceNodeType node) { string res_nam = node.name; //Debug.Log("ResourceRecovery: ResourceRow: res_nam=" + res_nam + " this_id=" + this_id + " last_id=" + last_id + " next_id=" + next_id); GUILayout.BeginHorizontal(); GUILayout.Label(String.Format("{0}", res_nam + " (" + node.display_order + ")"), style_stretchWidth_row); if (node.supply_mode != "0") { double string_number0 = 0; if (double.TryParse(node.storedamount, out string_number0)) { GUILayout.Label(String.Format("{0}", Math.Round(string_number0, 2)), style_100px_row); } else { GUILayout.Label(String.Format("{0}", node.storedamount), style_100px_row); } } else { GUILayout.Label(String.Format("{0}", RRSettingsController.get_resource_supply_mode_definition(0)), style_100px_row); } double calculated_kredit_value=0; Double.TryParse(node.value_factor, out calculated_kredit_value); calculated_kredit_value = (node.supply_mode != "2") ? calculated_kredit_value : (calculated_kredit_value*(-1)); if (node.supply_mode != "2") { if (GUILayout.Button("1", buttonStyle_small, GUILayout.Width(20))) { Debug.Log("Clicked Button = Buy 1" + res_nam); BuyResource(res_nam, calculated_kredit_value, 1); } if (GUILayout.Button("10", buttonStyle_small, GUILayout.Width(30))) { Debug.Log("Clicked Button = Buy 10" + res_nam); BuyResource(res_nam, calculated_kredit_value, 10); } if (GUILayout.Button("100", buttonStyle_small, GUILayout.Width(40))) { Debug.Log("Clicked Button = Buy 100" + res_nam); BuyResource(res_nam, calculated_kredit_value, 100); } if (GUILayout.Button("1000", buttonStyle_small, GUILayout.Width(40))) { Debug.Log("Clicked Button = Buy 1000" + res_nam); BuyResource(res_nam, calculated_kredit_value, 1000); } if (GUILayout.Button("10000", buttonStyle_small, GUILayout.Width(50))) { Debug.Log("Clicked Button = Buy 10000" + res_nam); BuyResource(res_nam, calculated_kredit_value, 10000); } } else { if (GUILayout.Button("-", buttonStyle_small, GUILayout.Width(20))) { } if (GUILayout.Button("--", buttonStyle_small, GUILayout.Width(30))) { } if (GUILayout.Button("---", buttonStyle_small, GUILayout.Width(40))) { } if (GUILayout.Button("----", buttonStyle_small, GUILayout.Width(40))) { } if (GUILayout.Button("-----", buttonStyle_small, GUILayout.Width(50))) { } } int string_number = 0; if (Int32.TryParse(node.supply_mode, out string_number)) { GUILayout.Label(String.Format("{0}", RRSettingsController.get_resource_supply_mode_definition(string_number)), style_60px_row); } else { GUILayout.Label(String.Format("{0}", node.supply_mode), style_60px_row); } GUIStyle centeredStyle = new GUIStyle(GUI.skin.label); centeredStyle.normal.textColor = Color.white; centeredStyle.alignment = TextAnchor.UpperCenter; GUILayout.Label(String.Format("{0}", calculated_kredit_value), centeredStyle, GUILayout.Width(60)); if (node.supply_mode!="0") { if (GUILayout.Button("10000", buttonStyle_small, GUILayout.Width(50))) { Debug.Log("Clicked Button = Sell 10000" + res_nam); SellResource(res_nam, calculated_kredit_value, 10000); } if (GUILayout.Button("1000", buttonStyle_small, GUILayout.Width(40))) { Debug.Log("Clicked Button = Sell 1000" + res_nam); SellResource(res_nam, calculated_kredit_value, 1000); } if (GUILayout.Button("100", buttonStyle_small, GUILayout.Width(40))) { Debug.Log("Clicked Button = Sell 100" + res_nam); SellResource(res_nam, calculated_kredit_value, 100); } if (GUILayout.Button("10", buttonStyle_small, GUILayout.Width(30))) { Debug.Log("Clicked Button = Sell 10" + res_nam); SellResource(res_nam, calculated_kredit_value, 10); } if (GUILayout.Button("1", buttonStyle_small, GUILayout.Width(20))) { Debug.Log("Clicked Button = Sell 1" + res_nam); SellResource(res_nam, calculated_kredit_value, 1); } } else { if (GUILayout.Button("-----", buttonStyle_small, GUILayout.Width(50))) { } if (GUILayout.Button("----", buttonStyle_small, GUILayout.Width(40))) { } if (GUILayout.Button("---", buttonStyle_small, GUILayout.Width(40))) { } if (GUILayout.Button("--", buttonStyle_small, GUILayout.Width(30))) { } if (GUILayout.Button("-", buttonStyle_small, GUILayout.Width(20))) { } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(splitter); GUILayout.EndHorizontal(); }
public ResourceNode(ResourceNodeBase resourceNodeBase, Vector2 position) : base(position, resourceNodeBase.Name, resourceNodeBase.Size, resourceNodeBase.Texture) { ResourceNodeType = resourceNodeBase.ResourceNodeType; }
/* RESOURCE { name = Antimatter storagecapacity = unlimited (ToDo) storedamount = 10.00 supply_mode = 1 value_factor = 1 display_order = 3 hide = 0 group = none } */ internal void ResourceRow(ResourceNodeType node, List<bool> _expanded, int counter, int TotalNumbr) { int this_id = counter; int last_id = counter - 1; int next_id = counter + 1; string res_nam = node.name; //Debug.Log("ResourceRecovery: ResourceRow: res_nam=" + res_nam + " this_id=" + this_id + " last_id=" + last_id + " next_id=" + next_id); GUILayout.BeginHorizontal(); GUILayout.Label(String.Format("{0}", res_nam + " (" + node.display_order + ")"), style_stretchWidth_row); double string_number0 = 0; if (double.TryParse(node.storedamount, out string_number0)) { GUILayout.Label(String.Format("{0}", Math.Round(string_number0, 2)), style_100px_row); } else { GUILayout.Label(String.Format("{0}", node.storedamount), style_100px_row); } int string_number = 0; if (Int32.TryParse(node.supply_mode, out string_number)) { GUILayout.Label(String.Format("{0}", RRSettingsController.get_resource_supply_mode_definition(string_number)), style_80px_row); } else { GUILayout.Label(String.Format("{0}", node.supply_mode), style_80px_row); } if (GUILayout.Button("Select", buttonStyle)) { Debug.Log("Clicked Button = Select" + res_nam); resourceSelected = res_nam; //DumpResource(res_nam); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(splitter); GUILayout.EndHorizontal(); }