Branding
Production personality profile has been moved from blueprint to factory
This commit is contained in:
parent
39ce6809c0
commit
a01d760f39
11 changed files with 1368 additions and 60 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" ?>
|
||||
<cherrytree>
|
||||
<node custom_icon_id="0" foreground="#a52a2a" is_bold="False" name="Tutorial" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591402810.0" ts_lastsave="1591403898.52" unique_id="3">
|
||||
<node custom_icon_id="0" foreground="#a52a2a" is_bold="False" name="Tutorial" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591402810.0" ts_lastsave="1591463775.78" unique_id="3">
|
||||
<rich_text></rich_text>
|
||||
<node custom_icon_id="0" foreground="" is_bold="False" name="Introduction/Survey Task" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591403624.27" ts_lastsave="1591403624.27" unique_id="9">
|
||||
<rich_text></rich_text>
|
||||
|
|
@ -462,9 +462,6 @@ Threefra: You seem to be under attack. How unfortunate. Do you maybe want to do
|
|||
<rich_text></rich_text>
|
||||
</node>
|
||||
</node>
|
||||
<node custom_icon_id="0" foreground="#2a612a" is_bold="False" name="Finch Cybernetics" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591404078.58" ts_lastsave="1591404078.58" unique_id="64">
|
||||
<rich_text></rich_text>
|
||||
</node>
|
||||
<node custom_icon_id="0" foreground="" is_bold="False" name="Congratulations on Not Being Dead" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591403898.52" ts_lastsave="1591403898.52" unique_id="20">
|
||||
<rich_text></rich_text>
|
||||
<node custom_icon_id="0" foreground="#4d4d4d" is_bold="False" name="ColferV" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591403946.68" ts_lastsave="1591403954.3" unique_id="30">
|
||||
|
|
@ -495,4 +492,148 @@ Threefra: [threefra grins and pointedly deletes the ‘assessment’ from her [t
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node custom_icon_id="0" foreground="" is_bold="False" name="Documentation" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591463775.78" ts_lastsave="1591463792.94" unique_id="77">
|
||||
<rich_text></rich_text>
|
||||
<node custom_icon_id="0" foreground="" is_bold="False" name="Company Chart" prog_lang="custom-colors" readonly="False" tags="" ts_creation="1591463792.94" ts_lastsave="1591465153.02" unique_id="78">
|
||||
<rich_text>
|
||||
</rich_text>
|
||||
<rich_text justification="left"></rich_text>
|
||||
<table char_offset="1" col_max="140" col_min="40">
|
||||
<row>
|
||||
<cell></cell>
|
||||
<cell></cell>
|
||||
<cell></cell>
|
||||
<cell></cell>
|
||||
<cell></cell>
|
||||
<cell></cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>
|
||||
|
||||
Finch Cybernetics
|
||||
</cell>
|
||||
<cell>To improve upon the basic, inefficient human form to the advancement of the species and to increase competitiveness with local flora and fauna</cell>
|
||||
<cell>Ptarmigan Stealth Tech
|
||||
|
||||
Bird of Paradise Beauty Products
|
||||
|
||||
Finch Medical
|
||||
|
||||
New Flight Aeronautics
|
||||
|
||||
Plexcorp</cell>
|
||||
<cell>“The search for knowledge is the duty of all intelligent beings.”
|
||||
|
||||
The human body is frail and limiting. Make it better.
|
||||
(Move past it entirely)</cell>
|
||||
<cell>Colorado Epps, second in command to the original founder, his mind preserved in an android body.
|
||||
(or is it?)</cell>
|
||||
<cell>Skin-like implants for changeable tattoos, which were then sold to the military as camouflage. Also gave them the patent for programmable fake skin, which significantly helped their development of true androids. </cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>Lucent Media Enterprises</cell>
|
||||
<cell>Encourage scientific and social progress via known dopamine reward channels, e.g., social media response, celebrity status, and the concept of positive reinforcement as a whole </cell>
|
||||
<cell>Skylight Media
|
||||
|
||||
Lucent Talent Search
|
||||
|
||||
VIt Energy Drinks
|
||||
|
||||
Nightlife Energy
|
||||
|
||||
Lucent Computing
|
||||
|
||||
<various mining & weapons corps></cell>
|
||||
<cell>“People will do anything for the adulation or loathing of their peers. We at Lucent have harnessed that heretofore destructive tendency for the benefit of all.”
|
||||
|
||||
Weaponized reality shows for technological advancement.</cell>
|
||||
<cell>Three siblings run Lucent together, each head of their own specialty.</cell>
|
||||
<cell>IDK, the future internet? (how does it differ from the current? I don’t know yet. I’d have to think about it.)
|
||||
|
||||
Nuclear Fusion reactors?</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>ColferV</cell>
|
||||
<cell>It is a truth universally acknowledged that nothing is as useful in diplomacy and warfare as a gigantic nuclear arsenal</cell>
|
||||
<cell>Seal Shipworks
|
||||
|
||||
ColferV Security
|
||||
|
||||
Deep Six Funerary Services
|
||||
|
||||
BBx Media
|
||||
|
||||
IV Medical</cell>
|
||||
<cell>“Impervious strength is the only good defense.”
|
||||
|
||||
Humanity is doomed unless we can outgun or outrun all comers.
|
||||
|
||||
The other major corporations are either complacent or destructively reckless and neither of those can be trusted in a hostile universe.
|
||||
|
||||
Slow, careful, inevitable expansion.
|
||||
|
||||
Build barricades. Expand. Eventually, the balance shifts.</cell>
|
||||
<cell>Buckeye Jones, notoriously paranoid and less notoriously entirely justified in it.</cell>
|
||||
<cell>Railguns, SmartArmour, and probably a very small but key part of a spaceship, which they charge out the nose for.</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>Miss Terri’s Sugariffic Snack Company</cell>
|
||||
<cell>Company representatives could not be reached for comment. We attempted entry into the local headquarters, only to wake up two light years away, dressed in shirts proclaiming us “Winners of East Helsinki Annual Pie Eating Contest” and reeking of coconut and burnt sugar.
|
||||
|
||||
Upon questioning, all members of the reporting team agreed that none of them had ever been to East Helsinki, and, indeed, weren’t sure whether it actually existed. </cell>
|
||||
<cell>Rock Candy Mining Corp
|
||||
|
||||
XL Pharmaceuticals
|
||||
|
||||
Jawbreaker Company (mercenaries)
|
||||
|
||||
Probably a good deal more that no one has been able to trace</cell>
|
||||
<cell>“It’s called my business because it’s none of yours.”
|
||||
|
||||
Who *is* Miss Terri, and how did she come to be running what is essentially the universe’s largest drug cartel?
|
||||
|
||||
|
||||
Candy for all!
|
||||
Suspiciously experimental substances for some!
|
||||
|
||||
|
||||
I feel that an argument could be made for a cult based on Twinkies.</cell>
|
||||
<cell>Miss Terri (last name unknown)</cell>
|
||||
<cell>Various snacks and the chemical composition and incidentals thereof</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>Aeronautics Unlimited</cell>
|
||||
<cell>Quick expansion and retrieval of resources is key to a successful quarter, every quarter.</cell>
|
||||
<cell>ARgos Mining
|
||||
|
||||
Regen Filtration and Shipware
|
||||
|
||||
Blast-Rite(tm)
|
||||
|
||||
AU Medical</cell>
|
||||
<cell>“Exploration. Extrication. Extermination.
|
||||
|
||||
…in a purely metaphorical sense, of course.”
|
||||
|
||||
It’s a space chase resource race at an unbelievable pace…
|
||||
|
||||
And if you stumble on their secret base, well,they’ll shoot you in the face. : )</cell>
|
||||
<cell>Valeria Corrigant </cell>
|
||||
<cell>Ion thrusters (A big deal when space travel was just kicking off, and a major reason they are still important now)
|
||||
|
||||
Lightsails?
|
||||
|
||||
Very speedy destructive mining tech</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell>Corporation</cell>
|
||||
<cell>Philosophy</cell>
|
||||
<cell>Subsidiaries</cell>
|
||||
<cell>Overview</cell>
|
||||
<cell>Leadership</cell>
|
||||
<cell>Tech</cell>
|
||||
</row>
|
||||
</table>
|
||||
</node>
|
||||
</node>
|
||||
</cherrytree>
|
||||
|
|
|
|||
1002
Assets/Prefabs/Input Field 1.prefab
Normal file
1002
Assets/Prefabs/Input Field 1.prefab
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/Prefabs/Input Field 1.prefab.meta
Normal file
7
Assets/Prefabs/Input Field 1.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5e84952f528d8644ebddaa8320c3edfa
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1265,6 +1265,12 @@ PrefabInstance:
|
|||
m_Modification:
|
||||
m_TransformParent: {fileID: 1888898928}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2378632238049155148, guid: 4fca44e21a27a6d48916d2cc4b6e2df0,
|
||||
type: 3}
|
||||
propertyPath: InputField
|
||||
value:
|
||||
objectReference: {fileID: 4412201880883430374, guid: 5e84952f528d8644ebddaa8320c3edfa,
|
||||
type: 3}
|
||||
- target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
|
|
@ -22136,7 +22142,7 @@ PrefabInstance:
|
|||
- target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -0.000061035156
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2378632238049155251, guid: 4fca44e21a27a6d48916d2cc4b6e2df0,
|
||||
type: 3}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ public class FactoryData : BehaviorData
|
|||
[InspectableField, JsonProperty("automation"), Key(2)]
|
||||
public int AutomationPoints;
|
||||
|
||||
[InspectableDatabaseLink(typeof(PersonalityAttribute)), JsonProperty("productionProfile"), Key(3)]
|
||||
public Dictionary<Guid, float> ProductionProfile = new Dictionary<Guid, float>();
|
||||
|
||||
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
|
||||
{
|
||||
return new Factory(context, this, entity, item);
|
||||
|
|
@ -28,6 +31,7 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
public double RetoolingTime;
|
||||
public string ItemName;
|
||||
public Guid ItemUnderConstruction;
|
||||
public bool Active;
|
||||
|
||||
public Entity Entity { get; }
|
||||
public Gear Item { get; }
|
||||
|
|
@ -47,8 +51,9 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
_blueprint = value;
|
||||
RetoolingTime = ToolingTime;
|
||||
_retooling = true;
|
||||
Active = false;
|
||||
ItemName = Context.Cache.Get<ItemData>(Context.Cache.Get<BlueprintData>(value).Item).Name;
|
||||
Item.Change();
|
||||
ItemName = Context.Cache.Get<BlueprintData>(value).Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,18 +79,6 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
var blueprint = Context.Cache.Get<BlueprintData>(_blueprint);
|
||||
if (blueprint == null)
|
||||
return false;
|
||||
|
||||
if (RetoolingTime > 0)
|
||||
{
|
||||
RetoolingTime -= delta;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_retooling)
|
||||
{
|
||||
_retooling = false;
|
||||
Item.Change();
|
||||
}
|
||||
|
||||
if (ItemUnderConstruction != Guid.Empty)
|
||||
{
|
||||
|
|
@ -108,19 +101,35 @@ public class Factory : IBehavior, IPersistentBehavior
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Applying exponents to two random numbers and adding them produces a range of interesting probability distributions for quality
|
||||
ItemUnderConstruction = Entity.Build(blueprint, blueprint.Quality *
|
||||
pow(ProductionQuality, blueprint.QualityExponent) *
|
||||
(pow(Context.Random.NextFloat(), blueprint.RandomExponent) +
|
||||
pow(Context.Random.NextFloat(), blueprint.RandomExponent)) / 2, ItemName);
|
||||
|
||||
if(ItemUnderConstruction!=Guid.Empty)
|
||||
if (RetoolingTime > 0)
|
||||
{
|
||||
RetoolingTime -= delta;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_retooling)
|
||||
{
|
||||
_retooling = false;
|
||||
Item.Change();
|
||||
}
|
||||
|
||||
if (Active)
|
||||
{
|
||||
// Applying exponents to two random numbers and adding them produces a range of interesting probability distributions for quality
|
||||
ItemUnderConstruction = Entity.Build(blueprint, blueprint.Quality *
|
||||
pow(ProductionQuality, blueprint.QualityExponent) *
|
||||
(pow(Context.Random.NextFloat(), blueprint.RandomExponent) +
|
||||
pow(Context.Random.NextFloat(), blueprint.RandomExponent)) / 2, ItemName);
|
||||
|
||||
if(ItemUnderConstruction!=Guid.Empty)
|
||||
Item.Change();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO Update Factory Persistence
|
||||
public PersistentBehaviorData Store()
|
||||
{
|
||||
return new FactoryPersistence
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class ThermotoggleData : BehaviorData
|
|||
|
||||
public class Thermotoggle : IBehavior
|
||||
{
|
||||
public float TargetTemperature;
|
||||
private ThermotoggleData _data;
|
||||
|
||||
private Entity Entity { get; }
|
||||
|
|
@ -34,10 +35,11 @@ public class Thermotoggle : IBehavior
|
|||
Entity = entity;
|
||||
Item = item;
|
||||
Context = context;
|
||||
TargetTemperature = data.TargetTemperature;
|
||||
}
|
||||
|
||||
public bool Update(float delta)
|
||||
{
|
||||
return Entity.Temperature < _data.TargetTemperature ^ _data.HighPass;
|
||||
return Entity.Temperature < TargetTemperature ^ _data.HighPass;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,9 +51,6 @@ public class BlueprintData : DatabaseEntry, INamedEntry
|
|||
[InspectableDatabaseLink(typeof(SimpleCommodityData)), JsonProperty("resourceRequirements"), Key(14)]
|
||||
public Dictionary<Guid, int> ResourceRequirements = new Dictionary<Guid, int>();
|
||||
|
||||
[InspectableDatabaseLink(typeof(PersonalityAttribute)), JsonProperty("productionProfile"), Key(15)]
|
||||
public Dictionary<Guid, float> ProductionProfile = new Dictionary<Guid, float>();
|
||||
|
||||
[IgnoreMember] public string EntryName
|
||||
{
|
||||
get => Name;
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ public class GameContext
|
|||
Ingredients = ingredients.Select(i=>i.ID).ToList(),
|
||||
Quality = Random.NextFloat(qualityMin, qualityMax),
|
||||
Blueprint = blueprint.ID,
|
||||
Name = $"Generic {item.Name}"
|
||||
Name = $"{item.Name}"
|
||||
};
|
||||
newGear.Durability = Evaluate(equippableItemData.Durability, newGear);
|
||||
Cache.Add(newGear);
|
||||
|
|
@ -827,7 +827,7 @@ public class GameContext
|
|||
Ingredients = ingredients.Select(i=>i.ID).ToList(),
|
||||
Quality = Random.NextFloat(qualityMin, qualityMax),
|
||||
Blueprint = blueprint.ID,
|
||||
Name = $"Generic {item.Name}"
|
||||
Name = $"{item.Name}"
|
||||
};
|
||||
Cache.Add(newCommodity);
|
||||
return newCommodity;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public class ColonyTab : MonoBehaviour
|
|||
foreach (var attribute in entity.Personality.Keys)
|
||||
personalityList.AddPersonalityProperty(Context.Cache.Get<PersonalityAttribute>(attribute),
|
||||
() => entity.Personality[attribute]);
|
||||
personalityList.SetExpanded(false, true);
|
||||
|
||||
General.RefreshValues();
|
||||
}
|
||||
|
|
@ -92,7 +93,7 @@ public class ColonyTab : MonoBehaviour
|
|||
|
||||
void RefreshInventory()
|
||||
{
|
||||
Debug.Log("Refreshing Inventory!");
|
||||
//Debug.Log("Refreshing Inventory!");
|
||||
|
||||
// Create item data mapping for cargo
|
||||
var cargoData = entity.Cargo.ToDictionary(id => _context.Cache.Get<ItemInstance>(id),
|
||||
|
|
@ -185,12 +186,48 @@ public class ColonyTab : MonoBehaviour
|
|||
else
|
||||
{
|
||||
Inventory.AddSection("Cargo");
|
||||
foreach (var x in cargoData)
|
||||
foreach (var itemID in entity.Cargo.Where(id => Context.Cache.Get<ItemInstance>(id) is SimpleCommodity))
|
||||
{
|
||||
if(x.Key is SimpleCommodity simpleCommodity)
|
||||
Inventory.AddProperty(x.Value.Name, () => simpleCommodity.Quantity.ToString());
|
||||
var simpleCommodity = Context.Cache.Get<SimpleCommodity>(itemID);
|
||||
var data = simpleCommodity.ItemData;
|
||||
Inventory.AddProperty(data.Name, () => simpleCommodity.Quantity.ToString(), eventData =>
|
||||
{
|
||||
Details.Clear();
|
||||
Details.AddItemProperties(simpleCommodity);
|
||||
Details.RefreshValues();
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var group in entity.Cargo
|
||||
.Select(id => Context.Cache.Get<ItemInstance>(id))
|
||||
.Where(item => item is CraftedItemInstance)
|
||||
.Cast<CraftedItemInstance>()
|
||||
.GroupBy(craftedItem => (craftedItem.Data, craftedItem.Name, Context.Cache.Get<Corporation>(Context.Cache.Get<Entity>(craftedItem.SourceEntity).Corporation))))
|
||||
{
|
||||
if (group.Count() == 1)
|
||||
{
|
||||
var item = group.First();
|
||||
Inventory.AddProperty(item.Name, null, eventData =>
|
||||
{
|
||||
Details.Clear();
|
||||
Details.AddItemProperties(item);
|
||||
Details.RefreshValues();
|
||||
});
|
||||
}
|
||||
else
|
||||
Inventory.AddProperty(x.Value.Name);
|
||||
{
|
||||
var instanceList = Inventory.AddList(group.Key.Name);
|
||||
foreach (var item in group)
|
||||
{
|
||||
instanceList.AddProperty(item.Name, null, eventData =>
|
||||
{
|
||||
Details.Clear();
|
||||
Details.AddItemProperties(item);
|
||||
Details.RefreshValues();
|
||||
});
|
||||
}
|
||||
instanceList.SetExpanded(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Inventory.RefreshValues();
|
||||
|
|
@ -213,9 +250,14 @@ public class ColonyTab : MonoBehaviour
|
|||
var bpItemData = _context.Cache.Get<ItemData>(blueprint.Item);
|
||||
|
||||
if(entity.GetBlueprintIngredients(blueprint, out _, out _))
|
||||
blueprintList.AddButton("Build", _ => entity.Build(blueprint, 1, bpItemData.Name, true));
|
||||
blueprintList.AddButton("Build", _ =>
|
||||
{
|
||||
entity.Build(blueprint, 1, bpItemData.Name, true);
|
||||
Details.Clear();
|
||||
});
|
||||
|
||||
blueprintList.RefreshValues();
|
||||
blueprintList.SetExpanded(false, true);
|
||||
}
|
||||
Details.RefreshValues();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,16 @@ public class PropertiesList : PropertiesPanel
|
|||
public void Start()
|
||||
{
|
||||
Button.OnClick += _ => ToggleExpand();
|
||||
SetExpanded(true, true);
|
||||
OnPropertyAdded += go => go.SetActive(_expanded);
|
||||
//SetExpanded(true, true);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
RefreshValues();
|
||||
_foldoutRotation =
|
||||
Mathf.Lerp(_foldoutRotation, _targetFoldoutRotation, FoldoutRotationDamping * Time.deltaTime);
|
||||
FoldoutIcon.transform.localRotation = Quaternion.Euler(0,0, _foldoutRotation);
|
||||
}
|
||||
|
||||
public void ToggleExpand() => SetExpanded(!_expanded, false);
|
||||
|
|
@ -42,13 +51,6 @@ public class PropertiesList : PropertiesPanel
|
|||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_foldoutRotation =
|
||||
Mathf.Lerp(_foldoutRotation, _targetFoldoutRotation, FoldoutRotationDamping * Time.deltaTime);
|
||||
FoldoutIcon.transform.localRotation = Quaternion.Euler(0,0, _foldoutRotation);
|
||||
}
|
||||
|
||||
// public override PropertyLabel AddProperty(string name, Func<string> read = null, Action<PointerEventData> onClick = null, bool radio = false)
|
||||
// {
|
||||
// var prop = base.AddProperty(name, read, onClick, radio);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PropertiesPanel : MonoBehaviour
|
||||
{
|
||||
|
|
@ -31,10 +33,11 @@ public class PropertiesPanel : MonoBehaviour
|
|||
protected event Action RefreshPropertyValues;
|
||||
protected bool RadioSelection = false;
|
||||
|
||||
protected event Action<GameObject> OnPropertyAdded;
|
||||
protected IDynamicProperties ChangeSource;
|
||||
protected Action OnPropertiesChanged;
|
||||
|
||||
protected void Update()
|
||||
public virtual void Update()
|
||||
{
|
||||
RefreshValues();
|
||||
}
|
||||
|
|
@ -72,6 +75,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
var section = Instantiate(SectionPrefab, transform);
|
||||
section.GetComponentInChildren<TextMeshProUGUI>().text = name;
|
||||
Properties.Add(section.gameObject);
|
||||
OnPropertyAdded?.Invoke(section.gameObject);
|
||||
return section;
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +108,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
if (read != null)
|
||||
RefreshPropertyValues += () => ((PropertyLabel) property).Value.text = read.Invoke();
|
||||
Properties.Add(property.gameObject);
|
||||
OnPropertyAdded?.Invoke(property.gameObject);
|
||||
return property;
|
||||
}
|
||||
|
||||
|
|
@ -122,6 +127,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
// }
|
||||
//RefreshPropertyValues += () => list.RefreshValues();
|
||||
Properties.Add(list.gameObject);
|
||||
OnPropertyAdded?.Invoke(list.gameObject);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
@ -133,6 +139,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
attributeInstance.LowLabel.text = attribute.LowName;
|
||||
RefreshPropertyValues += () => attributeInstance.Slider.value = read();
|
||||
Properties.Add(attributeInstance.gameObject);
|
||||
OnPropertyAdded?.Invoke(attributeInstance.gameObject);
|
||||
return attributeInstance;
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +149,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
button.Label.text = name;
|
||||
button.Button.OnClick += onClick;
|
||||
Properties.Add(button.gameObject);
|
||||
OnPropertyAdded?.Invoke(button.gameObject);
|
||||
return button;
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +160,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
button.ButtonLabel.text = label;
|
||||
button.Button.OnClick += onClick;
|
||||
Properties.Add(button.gameObject);
|
||||
OnPropertyAdded?.Invoke(button.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<string> read, Action<string> write)
|
||||
|
|
@ -160,8 +169,17 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Label.text = name;
|
||||
field.Field.contentType = TMP_InputField.ContentType.Standard;
|
||||
field.Field.onValueChanged.AddListener(val => write(val));
|
||||
RefreshPropertyValues += () => field.Field.text = read();
|
||||
RefreshPropertyValues += () =>
|
||||
{
|
||||
var s = read();
|
||||
if (field.Field.text != s)
|
||||
{
|
||||
field.Field.text = s;
|
||||
field.Field.Rebuild(CanvasUpdate.Layout);
|
||||
}
|
||||
};
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<float> read, Action<float> write)
|
||||
|
|
@ -172,6 +190,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Field.onValueChanged.AddListener(val => write(float.Parse(val)));
|
||||
RefreshPropertyValues += () => field.Field.text = read().ToString(CultureInfo.InvariantCulture);
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<int> read, Action<int> write)
|
||||
|
|
@ -182,6 +201,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Field.onValueChanged.AddListener(val => write(int.Parse(val)));
|
||||
RefreshPropertyValues += () => field.Field.text = read().ToString(CultureInfo.InvariantCulture);
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<float> read, Action<float> write, float min, float max)
|
||||
|
|
@ -194,6 +214,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Slider.onValueChanged.AddListener(val => write(val));
|
||||
RefreshPropertyValues += () => field.Slider.value = read();
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddProgressField(string name, Func<float> read)
|
||||
|
|
@ -206,6 +227,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
//field.Slider.onValueChanged.AddListener(val => write(val));
|
||||
RefreshPropertyValues += () => field.Slider.value = read();
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<int> read, Action<int> write, int min, int max)
|
||||
|
|
@ -218,6 +240,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Slider.onValueChanged.AddListener(val => write(Mathf.RoundToInt(val)));
|
||||
RefreshPropertyValues += () => field.Slider.value = read();
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<bool> read, Action<bool> write)
|
||||
|
|
@ -227,6 +250,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Toggle.onValueChanged.AddListener(val => write(val));
|
||||
RefreshPropertyValues += () => field.Toggle.isOn = read();
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
public void AddField(string name, Func<int> read, Action<int> write, string[] enumOptions)
|
||||
|
|
@ -237,6 +261,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
field.Dropdown.onValueChanged.AddListener(val => write(val));
|
||||
RefreshPropertyValues += () => field.Dropdown.value = read();
|
||||
Properties.Add(field.gameObject);
|
||||
OnPropertyAdded?.Invoke(field.gameObject);
|
||||
}
|
||||
|
||||
void RemoveListener()
|
||||
|
|
@ -261,9 +286,14 @@ public class PropertiesPanel : MonoBehaviour
|
|||
AddProperty("Mass", () => $"{entity.Mass.SignificantDigits(Context.GlobalData.SignificantDigits)}");
|
||||
AddProperty("Temperature", () => $"{entity.Temperature:0}°K");
|
||||
AddProperty("Energy", () => $"{entity.Energy:0}/{entity.GetBehaviors<Reactor>().First().Capacitance:0}");
|
||||
|
||||
var hardpointList = AddList("Gear");
|
||||
hardpointList.InspectHardpoints(entity);
|
||||
hardpointList.SetExpanded(false,true);
|
||||
|
||||
AddList("Gear").InspectHardpoints(entity);
|
||||
AddList("Cargo").InspectCargo(entity);
|
||||
var cargoList = AddList("Cargo");
|
||||
cargoList.InspectCargo(entity);
|
||||
cargoList.SetExpanded(false,true);
|
||||
|
||||
RefreshValues();
|
||||
}
|
||||
|
|
@ -281,8 +311,12 @@ public class PropertiesPanel : MonoBehaviour
|
|||
{
|
||||
Clear();
|
||||
var equippedItems = entity.Hardpoints.Where(hp => hp.Gear != null);
|
||||
foreach(var hardpoint in equippedItems)
|
||||
AddList(hardpoint.ItemData.Name).Inspect(entity, hardpoint);
|
||||
foreach (var hardpoint in equippedItems)
|
||||
{
|
||||
var propertyList = AddList(hardpoint.Gear.Name);
|
||||
propertyList.Inspect(entity, hardpoint);
|
||||
propertyList.SetExpanded(false,true);
|
||||
}
|
||||
RefreshValues();
|
||||
}
|
||||
}
|
||||
|
|
@ -299,32 +333,93 @@ public class PropertiesPanel : MonoBehaviour
|
|||
void InspectCargoInternal()
|
||||
{
|
||||
Clear();
|
||||
foreach (var itemID in entity.Cargo)
|
||||
foreach (var itemID in entity.Cargo.Where(id => Context.Cache.Get<ItemInstance>(id) is SimpleCommodity))
|
||||
{
|
||||
var itemInstance = Context.Cache.Get<ItemInstance>(itemID);
|
||||
var data = Context.Cache.Get<ItemData>(itemInstance.Data);
|
||||
if(itemInstance is SimpleCommodity simpleCommodity)
|
||||
AddProperty(data.Name, () => simpleCommodity.Quantity.ToString());
|
||||
else
|
||||
AddProperty(data.Name);
|
||||
var simpleCommodity = Context.Cache.Get<SimpleCommodity>(itemID);
|
||||
var data = simpleCommodity.ItemData;
|
||||
var propertiesList = AddList($"{simpleCommodity.Quantity.ToString()} {data.Name}");
|
||||
propertiesList.AddItemProperties(simpleCommodity);
|
||||
propertiesList.RefreshValues();
|
||||
propertiesList.SetExpanded(false, true);
|
||||
}
|
||||
|
||||
foreach (var group in entity.Cargo
|
||||
.Select(id => Context.Cache.Get<ItemInstance>(id))
|
||||
.Where(item => item is CraftedItemInstance)
|
||||
.Cast<CraftedItemInstance>()
|
||||
.GroupBy(craftedItem => (craftedItem.Data, craftedItem.Name, Context.Cache.Get<Corporation>(Context.Cache.Get<Entity>(craftedItem.SourceEntity).Corporation))))
|
||||
{
|
||||
if (group.Count() == 1)
|
||||
{
|
||||
var item = group.First();
|
||||
var propertiesList = AddList(item.Name);
|
||||
propertiesList.AddItemProperties(item);
|
||||
propertiesList.RefreshValues();
|
||||
propertiesList.SetExpanded(false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var instanceList = AddList($"{group.Count().ToString()} {group.Key.Name}");
|
||||
foreach (var item in group)
|
||||
{
|
||||
var propertiesList = instanceList.AddList(item.Name);
|
||||
propertiesList.AddItemProperties(item);
|
||||
propertiesList.RefreshValues();
|
||||
propertiesList.SetExpanded(false, true);
|
||||
}
|
||||
instanceList.SetExpanded(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
RefreshValues();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddItemProperties(ItemInstance item)
|
||||
{
|
||||
var data = Context.Cache.Get<ItemData>(item.Data);
|
||||
AddProperty("Type", () => data.Name);
|
||||
AddProperty(data.Description).Label.fontStyle = FontStyles.Normal;
|
||||
if (item is SimpleCommodity simpleCommodity)
|
||||
AddProperty("Quantity", () => simpleCommodity.Quantity.ToString());
|
||||
AddProperty("Mass", () => item.Mass.SignificantDigits(Context.GlobalData.SignificantDigits));
|
||||
AddProperty("Thermal Mass", () => item.ThermalMass.SignificantDigits(Context.GlobalData.SignificantDigits));
|
||||
AddProperty("Size", () => item.Size.SignificantDigits(Context.GlobalData.SignificantDigits));
|
||||
if (item is Gear gear)
|
||||
{
|
||||
var gearData = gear.ItemData;
|
||||
AddProperty("Durability", () =>
|
||||
$"{gear.Durability.SignificantDigits(Context.GlobalData.SignificantDigits)}/{Context.Evaluate(gearData.Durability, gear).SignificantDigits(Context.GlobalData.SignificantDigits)}");
|
||||
}
|
||||
if (item is CraftedItemInstance craftedItemInstance)
|
||||
{
|
||||
var entity = Context.Cache.Get<Entity>(craftedItemInstance.SourceEntity);
|
||||
if (entity != null)
|
||||
{
|
||||
var corporation = Context.Cache.Get<Corporation>(entity.Corporation);
|
||||
AddProperty("Manufacturer", () => corporation.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddProperty("Manufacturer", () => "God");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Inspect(Entity entity, Hardpoint hardpoint)
|
||||
{
|
||||
RemoveListener();
|
||||
|
||||
ChangeSource = hardpoint.Gear;
|
||||
OnPropertiesChanged = InspectGearInternal;
|
||||
OnPropertiesChanged = () => Observable.NextFrame().Subscribe(unit => InspectGearInternal());
|
||||
ChangeSource.OnChanged += OnPropertiesChanged;
|
||||
InspectGearInternal();
|
||||
|
||||
void InspectGearInternal()
|
||||
{
|
||||
Debug.Log($"Refreshing {hardpoint.Gear.Name} properties");
|
||||
Clear();
|
||||
AddProperty("Durability", () => $"{hardpoint.Gear.Durability.SignificantDigits(Context.GlobalData.SignificantDigits)}/{Context.Evaluate(hardpoint.ItemData.Durability, hardpoint.Gear).SignificantDigits(Context.GlobalData.SignificantDigits)}");
|
||||
AddItemProperties(hardpoint.Gear);
|
||||
foreach (var behavior in hardpoint.ItemData.Behaviors)
|
||||
{
|
||||
var type = behavior.GetType();
|
||||
|
|
@ -347,6 +442,8 @@ public class PropertiesPanel : MonoBehaviour
|
|||
}
|
||||
foreach (var behavior in hardpoint.Behaviors)
|
||||
{
|
||||
if (behavior is Thermotoggle thermotoggle)
|
||||
AddField("Target Temperature", () => thermotoggle.TargetTemperature, temp => thermotoggle.TargetTemperature = temp);
|
||||
if (behavior is Factory factory)
|
||||
{
|
||||
AddField("Production Quality", () => factory.ProductionQuality, f => factory.ProductionQuality = f, 0, 1);
|
||||
|
|
@ -364,9 +461,10 @@ public class PropertiesPanel : MonoBehaviour
|
|||
() => compatibleBlueprints.FindIndex(bp=>bp.ID== factory.Blueprint) + 1,
|
||||
i => factory.Blueprint = i == 0 ? Guid.Empty : compatibleBlueprints[i - 1].ID,
|
||||
new []{"None"}.Concat(compatibleBlueprints.Select(bp=>bp.Name)).ToArray());
|
||||
AddField("Active", () => factory.Active, active => factory.Active = active);
|
||||
if (factory.Blueprint != Guid.Empty)
|
||||
{
|
||||
if (factory.ItemUnderConstruction != Guid.Empty)
|
||||
if (factory.Active && factory.ItemUnderConstruction != Guid.Empty)
|
||||
{
|
||||
AddProgressField("Production", () =>
|
||||
{
|
||||
|
|
@ -378,6 +476,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
AddField("Product Name", () => factory.ItemName, name => factory.ItemName = name);
|
||||
var ingredientsList = AddList("Ingredients Needed");
|
||||
var blueprintData = Context.Cache.Get<BlueprintData>(factory.Blueprint);
|
||||
foreach (var ingredient in blueprintData.Ingredients)
|
||||
|
|
@ -385,6 +484,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
var itemData = Context.Cache.Get<ItemData>(ingredient.Key);
|
||||
ingredientsList.AddProperty(itemData.Name, () => ingredient.Value.ToString());
|
||||
}
|
||||
ingredientsList.SetExpanded(false, true);
|
||||
ingredientsList.RefreshValues();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue