Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Commit 4d683da

Browse files
author
Playfab Jenkins Bot
committed
https://api.playfab.com/releaseNotes/#170313
2 parents f9847c3 + 4468735 commit 4d683da

23 files changed

+1522
-2277
lines changed
-3.08 KB
Binary file not shown.

Source/Assets/PlayFabEditorExtensions/Editor/PlayFabEditor.cs

Lines changed: 155 additions & 198 deletions
Large diffs are not rendered by default.

Source/Assets/PlayFabEditorExtensions/Editor/Scripts/Components/ProgressBar.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ public static void Draw()
142142

143143
}
144144

145-
GUILayout.BeginHorizontal(pbarBgStyle);
146-
if (isReveresed)
145+
using (new UnityHorizontal(pbarBgStyle))
147146
{
148-
GUILayout.FlexibleSpace();
147+
if (isReveresed)
148+
{
149+
GUILayout.FlexibleSpace();
150+
}
151+
GUILayout.Label("", pbarStyle, GUILayout.Width(progressWidth));
149152
}
150-
GUILayout.Label("", pbarStyle, GUILayout.Width(progressWidth));
151-
GUILayout.EndHorizontal();
152153
}
153154
}
154155
}
Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Collections.Generic;
2-
using UnityEditor;
32
using UnityEngine;
43

54
namespace PlayFab.PfEditor
@@ -19,57 +18,45 @@ public void DrawMenu()
1918
defaultStyle = defaultStyle ?? PlayFabEditorHelper.uiStyle.GetStyle("textButton");
2019
bgStyle = bgStyle ?? PlayFabEditorHelper.uiStyle.GetStyle("gpStyleGray1");
2120

22-
GUILayout.BeginHorizontal(bgStyle, GUILayout.ExpandWidth(true));
23-
24-
foreach (var item in items)
21+
using (new UnityHorizontal(bgStyle, GUILayout.ExpandWidth(true)))
2522
{
26-
var styleToUse = item.Value.isSelected ? selectedStyle : defaultStyle;
27-
var content = new GUIContent(item.Value.displayName);
28-
var size = styleToUse.CalcSize(content);
29-
30-
if (GUILayout.Button(item.Value.displayName, styleToUse, GUILayout.Width(size.x + 1)))
23+
foreach (var item in items)
3124
{
32-
OnMenuItemClicked(item.Key);
25+
var styleToUse = item.Value.isSelected ? selectedStyle : defaultStyle;
26+
var content = new GUIContent(item.Value.displayName);
27+
var size = styleToUse.CalcSize(content);
28+
29+
if (GUILayout.Button(item.Value.displayName, styleToUse, GUILayout.Width(size.x + 1)))
30+
{
31+
OnMenuItemClicked(item.Key);
32+
}
3333
}
3434
}
35-
GUILayout.EndHorizontal();
3635
}
3736

3837
public void RegisterMenuItem(string n, System.Action m)
3938
{
4039
if (!items.ContainsKey(n))
4140
{
42-
bool selectState = false;
43-
int activeSubmenu = PlayFabEditorDataService.editorSettings.currentSubMenu;
44-
if (items.Count == 0 && activeSubmenu == 0)
45-
{
46-
selectState = true;
47-
}
48-
else if (activeSubmenu == items.Count)
49-
{
50-
// this is the menu being redrawn while also not being on the first menu tab
41+
var selectState = false;
42+
var activeSubmenu = PlayFabEditorDataService.EditorView == null ? 0 : PlayFabEditorDataService.EditorView.currentSubMenu;
43+
if (items.Count == 0 && activeSubmenu == 0 || activeSubmenu == items.Count)
5144
selectState = true;
52-
}
5345

5446
items.Add(n, new MenuItemContainer() { displayName = n, method = m, isSelected = selectState });
5547
}
56-
else
57-
{
58-
// update the method ?
59-
//items[n].method = m;
60-
}
6148
}
6249

6350
private void OnMenuItemClicked(string key)
6451
{
65-
if (items.ContainsKey(key))
52+
if (!items.ContainsKey(key))
53+
return;
54+
55+
DeselectAll();
56+
items[key].isSelected = true;
57+
if (items[key].method != null)
6658
{
67-
DeselectAll();
68-
items[key].isSelected = true;
69-
if (items[key].method != null)
70-
{
71-
items[key].method.Invoke();
72-
}
59+
items[key].method.Invoke();
7360
}
7461
}
7562

@@ -98,7 +85,7 @@ void StateUpdateHandler(PlayFabEditor.EdExStates state, string status, string js
9885
if (items != null)
9986
foreach (var each in items)
10087
{
101-
each.Value.isSelected = true;
88+
each.Value.isSelected = true; // Select the first
10289
break;
10390
}
10491
break;
@@ -108,8 +95,8 @@ void StateUpdateHandler(PlayFabEditor.EdExStates state, string status, string js
10895

10996
public class MenuItemContainer
11097
{
111-
public string displayName { get; set; }
112-
public System.Action method { get; set; }
113-
public bool isSelected { get; set; }
98+
public string displayName;
99+
public System.Action method;
100+
public bool isSelected;
114101
}
115102
}

Source/Assets/PlayFabEditorExtensions/Editor/Scripts/Components/TitleDataEditor.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ public class TitleDataEditor : UnityEditor.EditorWindow
1212
void OnGUI()
1313
{
1414
// The actual window code goes here
15-
EditorGUILayout.BeginHorizontal(PlayFabEditorHelper.uiStyle.GetStyle("gpStyleGray1"));
16-
GUILayout.Label(string.Format("Editing: {0}", key), PlayFabEditorHelper.uiStyle.GetStyle("orTitle"), GUILayout.MinWidth(EditorGUIUtility.currentViewWidth));
17-
EditorGUILayout.EndHorizontal();
15+
using (new UnityHorizontal(PlayFabEditorHelper.uiStyle.GetStyle("gpStyleGray1")))
16+
GUILayout.Label(string.Format("Editing: {0}", key), PlayFabEditorHelper.uiStyle.GetStyle("orTitle"), GUILayout.MinWidth(EditorGUIUtility.currentViewWidth));
1817

1918
scrollPos = GUILayout.BeginScrollView(scrollPos, PlayFabEditorHelper.uiStyle.GetStyle("gpStyleGray1"));
2019
Value = GUILayout.TextArea(Value, PlayFabEditorHelper.uiStyle.GetStyle("editTxt"));
2120
GUILayout.EndScrollView();
2221

2322

24-
EditorGUILayout.BeginHorizontal(PlayFabEditorHelper.uiStyle.GetStyle("gpStyleClear"));
25-
GUILayout.FlexibleSpace();
26-
if (GUILayout.Button("SAVE", PlayFabEditorHelper.uiStyle.GetStyle("Button"), GUILayout.MaxWidth(200)))
23+
using (new UnityHorizontal(PlayFabEditorHelper.uiStyle.GetStyle("gpStyleClear")))
2724
{
28-
for (int z = 0; z < PlayFabEditorDataMenu.tdViewer.items.Count; z++)
25+
GUILayout.FlexibleSpace();
26+
if (GUILayout.Button("SAVE", PlayFabEditorHelper.uiStyle.GetStyle("Button"), GUILayout.MaxWidth(200)))
2927
{
30-
if (PlayFabEditorDataMenu.tdViewer.items[z].Key == key)
28+
for (int z = 0; z < PlayFabEditorDataMenu.tdViewer.items.Count; z++)
3129
{
32-
PlayFabEditorDataMenu.tdViewer.items[z].Value = Value;
33-
PlayFabEditorDataMenu.tdViewer.items[z].isDirty = true;
30+
if (PlayFabEditorDataMenu.tdViewer.items[z].Key == key)
31+
{
32+
PlayFabEditorDataMenu.tdViewer.items[z].Value = Value;
33+
PlayFabEditorDataMenu.tdViewer.items[z].isDirty = true;
34+
}
3435
}
35-
}
36-
Close();
36+
Close();
3737

38+
}
39+
GUILayout.FlexibleSpace();
3840
}
39-
GUILayout.FlexibleSpace();
40-
EditorGUILayout.EndHorizontal();
4141

4242
Repaint();
4343
}
@@ -47,6 +47,5 @@ public void LoadData(string k, string v)
4747
key = k;
4848
Value = v;
4949
}
50-
5150
}
5251
}

0 commit comments

Comments
 (0)