Skip to content

Commit

Permalink
Fix general buy button display problems
Browse files Browse the repository at this point in the history
  • Loading branch information
TBartl committed Oct 5, 2018
1 parent 2e4012b commit a1016f7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1b5a19b7575d304428bf75145ce12a7e, type: 3}
m_Name:
m_EditorClassIdentifier:
icon: {fileID: 1353641394913594358}
text: {fileID: 260116989570973628}
--- !u!1 &4946730873475458377
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,32 @@

public class ExoFabBuildButton : MonoBehaviour, IOnPressed {

[SerializeField] Image icon;
[SerializeField] Text text;

RectTransform rt;

static int offset = 74;

public ExoFabBuildInformation BuildInformation { get; set; }
ExoFabBuildInformation buildInformation;
public ExoFabBuildInformation BuildInformation {
set {
buildInformation = value;
icon.sprite = value.icon;
icon.SetNativeSize();
text.text = value.displayName.Replace("\n", "");
}
}

void Awake() {
rt = this.GetComponent<RectTransform>();
}

public void OnPressed(Interactor by) {
Debug.Log("TODO");
}

public void SetPosition(int index) {
this.transform.localPosition = Vector3.down * offset;
this.rt.localPosition = Vector3.down * index * offset;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void TryBuild(ExoFabBuildInformation buildInformation) {
ExoFabBuildButton build = buildGO.GetComponent<ExoFabBuildButton>();
buildQueue.Add(build);
build.BuildInformation = buildInformation;
UpdateQueueIndexes();
}

void UpdateQueueIndexes() {
Expand Down

0 comments on commit a1016f7

Please sign in to comment.