Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
419 changes: 210 additions & 209 deletions Assembly-CSharp.csproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Gfx/MapArtAtlas.spriteatlas
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ SpriteAtlas:
bindAsDefault: 1
storedHash:
serializedVersion: 2
Hash: ddb26a9c7fb627e6fa2c89838de3e428
Hash: f182197f4c11897450df444f8673d3fd
m_MasterAtlas: {fileID: 0}
m_PackedSprites:
- {fileID: 21300000, guid: bbad87109ed7139478da68614fb0b7bb, type: 3}
Expand Down
44 changes: 44 additions & 0 deletions Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -9187,6 +9187,50 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 567752003}
m_CullTransparentMesh: 0
--- !u!1 &574688978
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 574688980}
- component: {fileID: 574688979}
m_Layer: 0
m_Name: InputManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &574688979
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 574688978}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8cd9965eea461b7489492cef950181fd, type: 3}
m_Name:
m_EditorClassIdentifier:
keybindings: {fileID: 11400000, guid: fa7ffefa2cb90374f85b6d2c028adb86, type: 2}
--- !u!4 &574688980
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 574688978}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 631.7344, y: 239.38911, z: -100.2714}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &590564739
GameObject:
m_ObjectHideFlags: 0
Expand Down
47 changes: 43 additions & 4 deletions Assets/Scripts/Interactive/ConnectionManager.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// Manager class that handles post-processing for connections.
/// Has a global singleton.
/// </summary>

public class ConnectionManager: MonoBehaviour
{
public static ConnectionManager s_connection_manager;
Expand All @@ -31,6 +29,46 @@ void Awake()
s_connection_manager = this;
}

private void Update()
{

if (InputManager.s_instance.KeyDown(Keybindings.ActionEnum.TOGGLEMOUNTAIN))
ToggleConnectionType(ConnectionType.MOUNTAIN);

if (InputManager.s_instance.KeyDown(Keybindings.ActionEnum.TOGGLEROAD))
ToggleConnectionType(ConnectionType.ROAD);

if (InputManager.s_instance.KeyDown(Keybindings.ActionEnum.TOGGLEMOUNTAINPASS))
ToggleConnectionType(ConnectionType.MOUNTAINPASS);

if (InputManager.s_instance.KeyDown(Keybindings.ActionEnum.TOGGLESTANDARD))
ToggleConnectionType(ConnectionType.STANDARD);

if (InputManager.s_instance.KeyDown(Keybindings.ActionEnum.TOGGLERIVER))
ToggleConnectionType(ConnectionType.RIVER);

}


private void ToggleConnectionType(ConnectionType target_CT)
{

if (m_current == null)
return;

ConnectionType current_CT = m_current.Connection.ConnectionType;

if (current_CT == target_CT)
{
SetConnectionType((int)ConnectionType.STANDARD);
}
else
{
SetConnectionType((int)target_CT);
}

}

public void SetLayout(NodeLayout layout)
{
m_layout = layout;
Expand All @@ -44,6 +82,7 @@ public void SetLayout(NodeLayout layout)
}
}*/


public void SetConnectionType(int ct)
{
if (m_current == null)
Expand Down
20 changes: 20 additions & 0 deletions Assets/Scripts/Interactive/GameKeybinds.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f0e10b42e1b6bcb4fbd993c8a74e8793, type: 3}
m_Name: GameKeybinds
m_EditorClassIdentifier:
toggleRoad: 114
toggleMountain: 109
toggleMountainPass: 112
toggleRiver: 118
toggleNormal: 110
generateMap: 103
8 changes: 8 additions & 0 deletions Assets/Scripts/Interactive/GameKeybinds.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions Assets/Scripts/Interactive/GenerationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class GenerationManager : MonoBehaviour
public MeshRenderer province_id_mesh_prefab;
GameObject province_id_map_container;

bool isGenerating = false;
bool m_generic_starts = false;
bool m_cluster_water = true;
bool m_teamplay = false;
Expand Down Expand Up @@ -79,7 +80,11 @@ void Start()

void Update()
{
Util.ResetFrameTime();
Util.ResetFrameTime();

if (InputManager.s_instance.KeyDown(Keybindings.ActionEnum.GENERATEMAP) && !isGenerating)
OnGenerate();

}

public void LogText(string text)
Expand Down Expand Up @@ -174,11 +179,14 @@ void MoveCameraForGeneration(NodeLayout layout)

IEnumerator do_generate(NodeLayout layout) // pipeline for initial generation of all nodes and stuff
{

foreach (GameObject obj in HideableButtons)
{
obj.SetActive(false);
}

isGenerating = true;

if (layout == null)
{
layout = m_layouts.Layouts.FirstOrDefault(x => x.NumPlayers == m_player_count);
Expand Down Expand Up @@ -211,6 +219,9 @@ void MoveCameraForGeneration(NodeLayout layout)
{
obj.SetActive(true);
}

isGenerating = false;

}

void do_regen(List<ProvinceMarker> provs, List<ConnectionMarker> conns, NodeLayout layout)
Expand Down Expand Up @@ -541,8 +552,12 @@ public void OnAgeChanged(Dropdown d)
m_content = new List<GameObject>();

update_nations();
}

}


/// <summary>
/// Populates the dropdown list for nation select
/// </summary>
void populate_nations(Dropdown d, int i)
{
var list = AllNationData.AllNations.Where(x => (x.Age == m_age || m_age == Age.ALL) && x.ID != -1);
Expand Down
47 changes: 47 additions & 0 deletions Assets/Scripts/Interactive/InputManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using UnityEngine;

/*
*
* This class should be left alone.
* Add hotkeys in Keybindings.cs
*
*/

public class InputManager : MonoBehaviour
{

public Keybindings keybindings;
public static InputManager s_instance;

private void Awake()
{
//Singleton
if (s_instance == null)
{
s_instance = this;
}
else if(s_instance != this)
{
Destroy(this);
}

DontDestroyOnLoad(this);

}


public bool KeyDown(Keybindings.ActionEnum key)
{

if(Input.GetKeyDown(keybindings.CheckKey(key)))
{
return true;
}
else
{
return false;
}

}

}
11 changes: 11 additions & 0 deletions Assets/Scripts/Interactive/InputManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Assets/Scripts/Interactive/Keybindings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using UnityEngine;

/*
*
* To add a new hotkey
* 1) Add KeyCode name (1001F)
* 3) Add to enum (1001F)
* 3) Add case (1001G)
* 4) Connect to function via Update in script
*
*/


[CreateAssetMenu(fileName = "GameKeybinds", menuName = "GameKeybinds")]
public class Keybindings : ScriptableObject
{
//1001F
public KeyCode toggle_road, toggle_mountain, toggle_mountain_pass, toggle_river, toggle_normal, generate_map;
public enum ActionEnum { TOGGLEROAD, TOGGLEMOUNTAIN, TOGGLEMOUNTAINPASS, TOGGLERIVER, TOGGLESTANDARD, GENERATEMAP };

//1001G
public KeyCode CheckKey(ActionEnum key)
{

switch(key)
{
case ActionEnum.TOGGLEROAD:
return toggle_road;
case ActionEnum.TOGGLEMOUNTAIN:
return toggle_mountain;
case ActionEnum.TOGGLEMOUNTAINPASS:
return toggle_mountain_pass;
case ActionEnum.TOGGLERIVER:
return toggle_river;
case ActionEnum.TOGGLESTANDARD:
return toggle_normal;
case ActionEnum.GENERATEMAP:
return generate_map;
default:
return KeyCode.None;

}

}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Interactive/Keybindings.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Assets/Scripts/Interactive/ProvinceManager.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// Manager class that handles post-processing for provinces.
/// Has a global singleton.
/// </summary>

public class ProvinceManager: MonoBehaviour
{
public static ProvinceManager s_province_manager;
Expand Down