Large diffs are not rendered by default.

@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &115298
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22421132}
- 222: {fileID: 22235670}
- 114: {fileID: 11434554}
- 114: {fileID: 11496636}
m_Layer: 5
m_Name: Analyze
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &11434554
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 115298}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11496636
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 115298}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bc7c3a7351089b64892935a509238903, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!222 &22235670
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 115298}
--- !u!224 &22421132
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 115298}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: 0, y: -50}
m_Pivot: {x: 0.5, y: 1}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 115298}
m_IsPrefabParent: 1
@@ -0,0 +1,92 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &122244
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22457462}
- 222: {fileID: 22220686}
- 114: {fileID: 11402164}
- 114: {fileID: 11492918}
m_Layer: 5
m_Name: Base
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &11402164
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 122244}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11492918
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 122244}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ae821dbcef2351649953c13fdb8dd366, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!222 &22220686
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 122244}
--- !u!224 &22457462
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 122244}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: 0, y: -50}
m_Pivot: {x: 0.5, y: 1}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 122244}
m_IsPrefabParent: 1
@@ -645,7 +645,7 @@ RectTransform:
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: -50}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: -20, y: 30}
m_Pivot: {x: 0, y: 1}
--- !u!224 &22430348
@@ -717,9 +717,9 @@ RectTransform:
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: 0, y: -50}
m_Pivot: {x: 0.5, y: 1}
--- !u!224 &22447432
RectTransform:
m_ObjectHideFlags: 1
@@ -737,7 +737,7 @@ RectTransform:
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -100}
m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: -20, y: 540}
m_Pivot: {x: 0.5, y: 1}
--- !u!224 &22473536
@@ -9,7 +9,6 @@ GameObject:
m_Component:
- 224: {fileID: 22490350}
- 222: {fileID: 22282964}
- 114: {fileID: 11476592}
- 114: {fileID: 11492710}
- 114: {fileID: 11400350}
m_Layer: 5
@@ -37,33 +36,6 @@ MonoBehaviour:
m_PreferredHeight: -1
m_FlexibleWidth: 1
m_FlexibleHeight: -1
--- !u!114 &11476592
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 118570}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11492710
MonoBehaviour:
m_ObjectHideFlags: 1
@@ -97,10 +69,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 30}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!1001 &100100000
Prefab:

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -101,10 +101,21 @@ public static class Clustering
private static ClusterMap _origCluster;
private static ClusterMap _normalizeCluster;

private static bool _isInitialize = false;
public static bool IsInitialize { get { return _isInitialize; } }

public static void Init(ClusterMap mapData)
{
_origCluster = mapData;
_normalizeCluster = Normolize(_origCluster);
if (mapData != null)
{
_origCluster = mapData;
_normalizeCluster = Normolize(_origCluster);

if (_origCluster != null && _normalizeCluster != null)
{
_isInitialize = true;
}
}
}

public static List<ClusterUnit> GetClasters(int clustersCount)
@@ -216,4 +227,9 @@ public static ClusterMap GetNormalize()
{
return _normalizeCluster;
}

public static ClusterMap GetRaw()
{
return _origCluster;
}
}
@@ -3,6 +3,20 @@
using System.Collections.Generic;
using UnityEngine;



public static class DataStorageConfig
{

public static Dictionary<string, string> TableNames = new Dictionary<string, string>()
{
{"1911 - 1939", "Data2"},
{"1939 - 1945", "Data2"},
{"1945 - 1970", "Data2"},
{"1970 - 1990", "Data2"}
};
}

[Serializable]
public class StoragelocationDataKeyValue
{
@@ -29,9 +43,9 @@ public class StorageMapData
public static class DataStorage
{

public static StorageMapData LoadData()
public static StorageMapData LoadData(string name)
{
var textAsset = Resources.Load<TextAsset>("Data2");
var textAsset = Resources.Load<TextAsset>(name);

return JsonUtility.FromJson<StorageMapData>(textAsset.text);
}
@@ -0,0 +1,7 @@
using UnityEngine;
using System.Collections;

public class Analyze : UIItem {


}
@@ -0,0 +1,8 @@
using UnityEngine;
using System.Collections;

public class BaseState : UIItem
{


}
@@ -23,8 +23,15 @@ public class DataGridContent : UIItem

public void Init(Dictionary<string, List<string>> data)
{
_dataGridLines = new Dictionary<string, DataGridLine>();
if (_dataGridLines != null && _dataGridLines.Values.Count > 0)
{
foreach (var dataGridLine in _dataGridLines.Values)
{
Destroy(dataGridLine.gameObject);
}
}

_dataGridLines = new Dictionary<string, DataGridLine>();
var lineNuber = 0;
foreach (var key in data.Keys)
{
@@ -19,6 +19,14 @@ public class DataGridHeader : UIItem

public void Init(List<string> data)
{
if (_dataGridColumns != null && _dataGridColumns.Count > 0)
{
foreach (var dataGridColumn in _dataGridColumns)
{
Destroy(dataGridColumn.gameObject);
}
}

_dataGridColumns = new List<DataGridColumn>();

_data = data;
@@ -0,0 +1,26 @@

using UnityEngine;
using System.Collections;
using UnityEditor;
using UnityEngine.UI;


[CustomEditor(typeof (MainMenu))]
public class MainMenuEditor : Editor
{

public override void OnInspectorGUI()
{
DrawDefaultInspector();

//if (GUILayout.Button("copyColors"))
//{
// var mainMenu = target as MainMenu;

// var map = mainMenu.GetComponentInChildren<Map>();
// map._colors = mainMenu._colors;

// //EditorUtility
//}
}
}
@@ -11,6 +11,8 @@ public class MapEditor : Editor {

public override void OnInspectorGUI()
{
DrawDefaultInspector();

Map map = (Map)target;

GUILayout.Label("Map");

This file was deleted.

@@ -2,9 +2,13 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.UI;


public class MainMenu : MonoBehaviour
{
[SerializeField]
private BaseState _base;

[SerializeField]
private Map _map;
@@ -13,63 +17,39 @@ public class MainMenu : MonoBehaviour
private DataGrid _dataGrid;

[SerializeField]
private LizmaState _lizmaState;
private Analyze _analyze;



[SerializeField]
private Color[] _colors;
private Dropdown _dropdownDataTable;

private StorageMapData _mapData;
//private StorageMapData _mapData;


void Start ()
private void Start()
{
_mapData = DataStorage.LoadData();

InitDataGrid(_mapData);
InitCluster(_mapData);

ShowMapClaser(Clustering.GetClasters(4));
var dataList = DataStorageConfig.TableNames.Keys.ToList();
if (dataList.Count > 0)
{
ChooseDropdownHendler(0);
_dropdownDataTable.AddOptions(dataList);
}

_analyze.Hide();
_base.Show();
_dataGrid.Hide();
_map.Hide();
_lizmaState.Hide();
}

void Update()
{

}

public void ShowMapClaser(List<ClusterUnit> clasers)
{
var map = Clustering.GetNormalize();

for (var i = 0; i < clasers.Count; i++)
{
var item = map.GetFirstInRow(clasers[i].Row);
_map.SetColor(item.Id, _colors[clasers[i].Cluster]);
}
}

public void ShowMapAllParam(string key, Color color)
{
var map = Clustering.GetNormalize();

if (map == null)
if (Input.GetKeyUp(KeyCode.Escape))
{
return;
}

List<ClusterDataItem> column = map.ColumnsToList(key);

column.Sort((x, y) => x.Value.CompareTo(y.Value));

for (var i = 0; i < column.Count; i++)
{
_map.SetColor(column[i].Id, _colors[i]);
Application.Quit();
}
}


private void InitCluster(StorageMapData storageMapData)
{
@@ -86,24 +66,23 @@ private void InitCluster(StorageMapData storageMapData)
Clustering.Init(result);
}

private void InitDataGrid(StorageMapData storageMapData)
private void InitDataGrid(ClusterMap clusterMap)
{
var header = storageMapData.header.ToList();
var header = new List<string>() {"Name:"};
header.AddRange(clusterMap.ColumnsKeys);

Dictionary<string, List<string>> stringData = new Dictionary<string, List<string>>();

foreach (var location in storageMapData.map)
foreach (var rowsKey in clusterMap.RowsKeys)
{
var stringList = new List<string>();

stringList.Add(location.name);

foreach (var locationDataKeyValue in location.data)
var stringList = new List<string>() {rowsKey};
foreach (var clusterDataItem in clusterMap.RowsToList(rowsKey))
{
stringList.Add(locationDataKeyValue.value.ToString());

stringList.Add(clusterDataItem.Value.ToString());
}

stringData.Add(location.name, stringList);
stringData.Add(rowsKey, stringList);
}

_dataGrid.Init(header, stringData);
@@ -112,22 +91,83 @@ private void InitDataGrid(StorageMapData storageMapData)

public void LoadButtonHendler()
{
if (!Clustering.IsInitialize)
{
return;
}

_analyze.Hide();
_base.Hide();
_map.Hide();
_dataGrid.Show();

InitDataGrid(Clustering.GetRaw());
}

public void NormalizeButtonHendler()
{
if (!Clustering.IsInitialize)
{
return;
}

_analyze.Hide();
_base.Hide();
_map.Hide();
_lizmaState.Hide();
_dataGrid.Show();

InitDataGrid(Clustering.GetNormalize());
}

public void ShowMapButtonHendler()
{
_map.Show();
if (!Clustering.IsInitialize)
{
return;
}

_analyze.Hide();
_base.Hide();
_dataGrid.Hide();
_lizmaState.Hide();
_map.Show();
}

public void SHowLizmaState()

public void AnalyzeButtonHendler()
{
if (!Clustering.IsInitialize)
{
return;
}

_base.Hide();
_dataGrid.Hide();
_map.Hide();
_analyze.Show();
}

public void ChooseDropdownHendler(int index)
{
var list = DataStorageConfig.TableNames.Keys.ToList();
if (index < list.Count)
{
var key = list[index];

string tableName;
if (DataStorageConfig.TableNames.TryGetValue(key, out tableName))
{
ChooseDropdownHendler(tableName);
}
}

}

public void ChooseDropdownHendler(string value)
{
_base.Hide();
_dataGrid.Hide();
_lizmaState.Show();
_map.Hide();

InitCluster(DataStorage.LoadData(value));
}
}
@@ -2,6 +2,7 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.UI;

[Serializable]
@@ -16,8 +17,20 @@ public class MapImageData

public class Map : UIItem
{
[SerializeField]
public Dropdown _mapColumnDropdown;

[SerializeField]
public Dropdown _mapClusterCountDropdown;

[SerializeField]
private Color[] _colors;

[SerializeField] public List<MapImageData> MapList;

public List<MapImageData> MapList;
private int _clustersCount = 2;

private ClusterMap _clusterMap;

public void SetColor(string key, Color color)
{
@@ -35,7 +48,7 @@ public void SetColorAll(Color color)
{
foreach (var mapImageData in MapList)
{
mapImageData.Value.color = color;
mapImageData.Value.color = color;
}
}

@@ -48,4 +61,80 @@ public List<string> GetAllLocations()
}
return result;
}

public override void Show()
{
base.Show();
_clusterMap = Clustering.GetRaw();
_mapColumnDropdown.ClearOptions();
_mapColumnDropdown.AddOptions(_clusterMap.ColumnsKeys.ToList());

var listClusterCount = new List<string>();
for (var i = 0; i < 27; i++)
{
listClusterCount.Add(i.ToString());
}
_mapClusterCountDropdown.ClearOptions();
_mapClusterCountDropdown.AddOptions(listClusterCount);
}

public void SetClasterCount(int index)
{
_clustersCount = index;
}

public void ShowOnMapColumn(int index)
{
var list = _clusterMap.ColumnsKeys.ToList();
if (index < list.Count)
{
ShowOnMapColumn(list[index]);
}
}

public void ShowOnMapClaser(List<ClusterUnit> clasers)
{
var map = Clustering.GetNormalize();

for (var i = 0; i < clasers.Count; i++)
{
var item = map.GetFirstInRow(clasers[i].Row);
SetColor(item.Id, _colors[clasers[i].Cluster]);
}
}

public void ShowOnMapColumn(string column)
{
if (_clustersCount < 1)
{
return;
}

List<ClusterDataItem> columns = _clusterMap.ColumnsToList(column);

int itemInClaster = (int)Mathf.Round((float)columns.Count/(float)_clustersCount);

int currentClaster = 0;
int columnsInClusterCount = 0;

columns.Sort((x, y) => x.Value.CompareTo(y.Value));

for (var i = 0; i < columns.Count; i++)
{
SetColor(columns[i].Id, _colors[currentClaster]);

++columnsInClusterCount;

if (columnsInClusterCount >= itemInClaster)
{
columnsInClusterCount = 0;
if (currentClaster < _clustersCount - 1)
{
++currentClaster;
}
}


}
}
}
@@ -168,12 +168,13 @@ PlayerSettings:
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
resolutionDialogBanner: {fileID: 0}
resolutionDialogBanner: {fileID: 2800000, guid: 33d8efba6fb195149888c99a48428d1c,
type: 3}
m_BuildTargetIcons:
- m_BuildTarget:
m_Icons:
- serializedVersion: 2
m_Icon: {fileID: 0}
m_Icon: {fileID: 2800000, guid: 33d8efba6fb195149888c99a48428d1c, type: 3}
m_Width: 128
m_Height: 128
m_BuildTargetBatching: []