Skip to content

Commit

Permalink
added label changes for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
robhillman97 committed Aug 2, 2023
1 parent 9b8824b commit 7e0deb5
Show file tree
Hide file tree
Showing 5 changed files with 3,138 additions and 455 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void Open(Action action, ToggleObject annotation)
var stepNumber = trigger != null ? trigger.value : "1";
stepTrigger.Initiate(annotationToEdit, duration, stepNumber);

if (annotationToEdit.option != null)
if (annotationToEdit.option != "")
{
string[] splitArray = annotationToEdit.option.Split(char.Parse("-"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3088279811579635628}
- {fileID: 4529781168000445945}
Expand Down Expand Up @@ -66,18 +67,22 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bc9c1adc7b343404e9dfc02ea66509c4, type: 3}
m_Name:
m_EditorClassIdentifier:
canBeClosedByOutTap: 1
_icon: {fileID: 8849469719266741702}
_txtLabel: {fileID: 4500423376849114990}
_btnAccept: {fileID: 1318640481335322013}
_btnClose: {fileID: 8340247395932589955}
_inputField: {fileID: 3161357692059685080}
_toggleTrigger: {fileID: 2550349263833516608}
_slider: {fileID: 5680053219410164110}
_txtSliderValue: {fileID: 8252593959169086208}
_txtStep: {fileID: 6670868473422912819}
_btnNextStep: {fileID: 2220713431602419440}
_btnPreviousStep: {fileID: 8522928032060602069}
_btnIncreaseGazeDuration: {fileID: 0}
_btnDecreaseGazeDuration: {fileID: 0}
_txtGazeDurationValue: {fileID: 0}
_gazeDurationPanel: {fileID: 0}
_clampedScrollJumpToStep: {fileID: 0}
_templatePrefab: {fileID: 0}
_btnArrow: {fileID: 0}
_panel: {fileID: 0}
_arrowDown: {fileID: 0}
_arrowUp: {fileID: 0}
--- !u!114 &8371701705238998908
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -540,42 +545,6 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 889154362817745572}
m_PrefabAsset: {fileID: 0}
--- !u!114 &8522928032060602069 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8795931175476356209, guid: 4cfc48ceaba9454419be4feed987a055,
type: 3}
m_PrefabInstance: {fileID: 889154362817745572}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6670868473422912819 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5820135776511594391, guid: 4cfc48ceaba9454419be4feed987a055,
type: 3}
m_PrefabInstance: {fileID: 889154362817745572}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &2220713431602419440 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1335148201965274196, guid: 4cfc48ceaba9454419be4feed987a055,
type: 3}
m_PrefabInstance: {fileID: 889154362817745572}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &5269682161174945692
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -755,12 +724,6 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6c30edebc2ad75e4b9e3127da5e3b06b, type: 3}
--- !u!224 &8573561306456671712 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4601206109572291196, guid: 6c30edebc2ad75e4b9e3127da5e3b06b,
type: 3}
m_PrefabInstance: {fileID: 5269682161174945692}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1318640481335322013 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6588041167533423105, guid: 6c30edebc2ad75e4b9e3127da5e3b06b,
Expand All @@ -785,6 +748,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &8573561306456671712 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4601206109572291196, guid: 6c30edebc2ad75e4b9e3127da5e3b06b,
type: 3}
m_PrefabInstance: {fileID: 5269682161174945692}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5866456573898448022
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -991,12 +960,6 @@ PrefabInstance:
m_RemovedComponents:
- {fileID: 4732870783210020861, guid: b36fff3ab4d580742bfe10c8d6979275, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: b36fff3ab4d580742bfe10c8d6979275, type: 3}
--- !u!224 &4529781168000445945 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8049292444867719535, guid: b36fff3ab4d580742bfe10c8d6979275,
type: 3}
m_PrefabInstance: {fileID: 5866456573898448022}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3161357692059685080 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8842449799615761486, guid: b36fff3ab4d580742bfe10c8d6979275,
Expand All @@ -1009,6 +972,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2da0c512f12947e489f739169773d7ca, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &4529781168000445945 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8049292444867719535, guid: b36fff3ab4d580742bfe10c8d6979275,
type: 3}
m_PrefabInstance: {fileID: 5866456573898448022}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &6178790698379331975
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1412,30 +1381,6 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 7655035019003880377}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5680053219410164110 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2661556485882337847, guid: 93f4fe852044a1f4fb18e36067d8634e,
type: 3}
m_PrefabInstance: {fileID: 7655035019003880377}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8252593959169086208 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1782088111177085113, guid: 93f4fe852044a1f4fb18e36067d8634e,
type: 3}
m_PrefabInstance: {fileID: 7655035019003880377}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &8757742098643664344
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1626,12 +1571,6 @@ PrefabInstance:
type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2f0e1b13a26bc6a4badadf0417c028ba, type: 3}
--- !u!224 &7528319332892014754 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 1292593025575830906, guid: 2f0e1b13a26bc6a4badadf0417c028ba,
type: 3}
m_PrefabInstance: {fileID: 8757742098643664344}
m_PrefabAsset: {fileID: 0}
--- !u!114 &2550349263833516608 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6552008676697864088, guid: 2f0e1b13a26bc6a4badadf0417c028ba,
Expand All @@ -1644,3 +1583,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &7528319332892014754 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 1292593025575830906, guid: 2f0e1b13a26bc6a4badadf0417c028ba,
type: 3}
m_PrefabInstance: {fileID: 8757742098643664344}
m_PrefabAsset: {fileID: 0}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override bool Init(ToggleObject obj)
gameObject.AddComponent<Billboard>();
}

if (obj.option != null)
if (obj.option != "")
{
string[] splitArray = obj.option.Split(char.Parse("-"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ public class IntHolder : ObjectHolder<int> { }
[SerializeField] private GameObject _gazeDurationPanel;
[SerializeField] private ClampedScrollRect _clampedScrollJumpToStep;
[SerializeField] private GameObject _templatePrefab;
[SerializeField] private GameObject _settingsPannel;
[SerializeField] private GameObject _mainPannel;

[SerializeField] private TMP_Text _exampleLabel;
[SerializeField] private Image _exampleLabelBackground;
[SerializeField] private TMP_InputField _fontSize;

[SerializeField] private Image _fontColourButtonImage;
[SerializeField] private Image _backgroundColourButtonImage;

[SerializeField] private ColourSelector _colourPickerScript;
[Space]
[SerializeField] private Button _btnArrow;
[SerializeField] private RectTransform _panel;
Expand All @@ -34,9 +45,13 @@ public class IntHolder : ObjectHolder<int> { }
private Trigger _trigger;
private float _gazeDuration;
private int _triggerStepIndex;
private enum ColourPickerOption { NA, Font, Background };

private ColourPickerOption _colourPickerOption = ColourPickerOption.NA;

public override void Initialization(Action<PopupBase> onClose, params object[] args)
{
_colourPickerScript.onColourSelected.AddListener(OnColourPickerChange);
_showBackground = false;
base.Initialization(onClose, args);
_toggleTrigger.onValueChanged.AddListener(OnTriggerValueChanged);
Expand Down Expand Up @@ -75,12 +90,25 @@ private void UpdateView()
{
_inputField.text = _content.text;
_trigger = _step.triggers.Find(tr => tr.id == _content.poi);

if (_trigger != null)
{
_toggleTrigger.isOn = true;
_triggerStepIndex = int.Parse(_trigger.value) - 1;
_gazeDuration = _trigger.duration;
}

if (_content.option != "")
{
string[] splitArray = _content.option.Split(char.Parse("-"));

_exampleLabel.text = _content.text;

_exampleLabel.fontSize = int.Parse(splitArray[0]);

_exampleLabel.color = GetColorFromString(splitArray[1]);
_exampleLabelBackground.color = GetColorFromString(splitArray[2]);
}
}
}

Expand Down Expand Up @@ -152,6 +180,7 @@ protected override void OnAccept()
_content.predicate = editorForType.GetPredicate();
}
_content.text = _inputField.text;
_content.option = _exampleLabel.fontSize.ToString() + "-" + _exampleLabel.color.ToString() + "-" + _exampleLabelBackground.color.ToString();

if (_toggleTrigger.isOn)
{
Expand Down Expand Up @@ -188,4 +217,72 @@ private void OnDestroy()
{
RootView_v2.Instance.ShowBaseView();
}

public void OpenSettings(bool open)
{
_settingsPannel.SetActive(open);
_mainPannel.SetActive(!open);
}

public void OnFontSizeChanged()
{
var size = 36;

int.TryParse(_fontSize.text, out size);

_exampleLabel.fontSize = size;
}


public void OnFontColourChange()
{
// _colourPickerObject.SetActive(true);
_colourPickerScript.Open();
_colourPickerOption = ColourPickerOption.Font;
}

public void OnBackgroundColourChanged()
{
//_colourPickerObject.SetActive(true);
_colourPickerScript.Open();
_colourPickerOption = ColourPickerOption.Background;
}

public void OnColourPickerChange()
{
switch (_colourPickerOption)
{
case ColourPickerOption.Font:
_exampleLabel.color = _colourPickerScript._selectedColour;
break;
case ColourPickerOption.Background:
_exampleLabelBackground.color = _colourPickerScript._selectedColour;
break;
default:
break;
}

UpdateButtonColours();

_colourPickerOption = ColourPickerOption.NA;
}

private Color GetColorFromString(string rgb)
{
string[] rgba = rgb.Substring(5, rgb.Length - 6).Split(", ");
Color color = new Color(float.Parse(rgba[0]), float.Parse(rgba[1]), float.Parse(rgba[2]), float.Parse(rgba[3]));

return color;
}

public void onInputChanged()
{
_exampleLabel.text = _inputField.text;
}

private void UpdateButtonColours()
{
_fontColourButtonImage.color = _exampleLabel.color;
_backgroundColourButtonImage.color = _exampleLabelBackground.color;
}
}
Loading

0 comments on commit 7e0deb5

Please sign in to comment.