Science Manager and Galaxy merging

This commit is contained in:
mkadou
2023-06-20 20:24:53 +02:00
parent 0086c8705f
commit 05142dbb22
112 changed files with 5145 additions and 749 deletions

View File

@@ -7,7 +7,7 @@ public class GalaxyUI : MonoBehaviour
{
public GameObject galaxyPrefab; // Prefab des Galaxy-Objekts
public int numberOfGalaxies; // Anzahl der zu erstellenden Galaxien
int numberOfGalaxies = GameUI.PlayersNumber; // Anzahl der zu erstellenden Galaxien
public float distanceFromCenter; // Abstand der Galaxien vom Hauptobjekt
public GameObject canvas; // Referenz auf das Canvas-Objekt
private GameObject[] SolarSystems = new GameObject[12];

70
Assets/GameUI.cs Normal file
View File

@@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class GameUI : MonoBehaviour
{
static public int PlayersNumber = 1;
static GameUI Instance;
public TMP_Dropdown dropdown; // Referenz auf das Dropdown-Objekt im Unity Inspector
void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
// Start is called before the first frame update
void Start()
{
dropdown.onValueChanged.AddListener(HandleDropdownValueChanged);
}
public void HandleInputData(int val)
{
if (val == 0)
{
Debug.Log("PlayersNumber = 1;");
PlayersNumber = 1;
}
if (val == 1)
{
Debug.Log("PlayersNumber = 2;");
PlayersNumber = 2;
}
if (val == 2)
{
Debug.Log("PlayersNumber = 4;");
PlayersNumber = 4;
}
if (val == 3)
{
Debug.Log("PlayersNumber = 8;");
PlayersNumber = 8;
}
if (val == 4)
{
Debug.Log("PlayersNumber = 16;");
PlayersNumber = 16;
}
}
void HandleDropdownValueChanged(int val)
{
HandleInputData(val);
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,86 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: vehicle_rcLand_clean_dome_mat
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _NORMALMAP
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0.6923018}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -145,7 +145,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 7cb2912222469634ba17a77055919ea8, type: 3}
m_FontSize: 0
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
@@ -190,7 +190,7 @@ RectTransform:
m_Children:
- {fileID: 22400000}
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,16 +5,22 @@ using System.Dynamic;
using System.Reflection.Emit;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class ScienceManager : MonoBehaviour
{
{
public int ScienceCostCurrentTech;
public GameObject ScienceUI;
public Text AccScienceLabel;
//public Text AccScienceLabel;
public static int TechnologiesTotal = 4;
public Tech[] techs = new Tech[TechnologiesTotal];
public GameObject[] objectsToDeactivate;
public GameObject[] objectsToActivate;
public string SceneName;
private bool ScineActiveState = true;
public Text CostText;
public Text[] TechQueueUIArr = new Text[4];
public Text[] TechLevelLabels = new Text[4];
@@ -34,6 +40,8 @@ public class ScienceManager : MonoBehaviour
UpdateScience(0);
}
// Update is called once per frame
void Update()
{
@@ -52,7 +60,30 @@ public class ScienceManager : MonoBehaviour
{
ScienceUI.SetActive(true);
}
if (ScineActiveState)
{
ScineActiveState = false;
for (int i = 0; i < objectsToDeactivate.Length; i++)
{
objectsToDeactivate[i].SetActive(false); // deactivate the game object
}
}
else
{
ScineActiveState = true;
for (int i = 0; i < objectsToActivate.Length; i++)
{
objectsToActivate[i].SetActive(true); // activate the game object
}
}
}
// To change the scene by name
public void ChangeScene()
{
SceneManager.LoadScene(SceneName);
}
/// <summary>
/// increase tech level
/// reduce acumulated Science
@@ -182,7 +213,7 @@ public class ScienceManager : MonoBehaviour
public void UpdateScienceUI()
{
UpdateQueueText();
AccScienceLabel.text = ScienceAcumulated.ToString();
//AccScienceLabel.text = ScienceAcumulated.ToString();
for (int i = 0; i < TechLevelLabels.Length; i++)
{
TechLevelLabels[i].text = techs[i].Level.ToString();

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f380765f06574468792284654c96955a
guid: 7a37759183d2c0d4085dd86c912d2337
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 34314e90385267f47ad6fc2df40f0d16
guid: eee684256d861f142b07b394cb351237
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: ee7104d2ffb92f84a9d1ac3411c1c12f
guid: e74fe53edc1b6434a9ff7924d0c720dc
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 8ced7259e0f79b04185539c0fa69a4aa
guid: 74abd3e0badc1834eb826a5224efa5aa
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: b4cc44d390fb3b442a5aa52028754572
guid: f56f7b654fe95144289a68e85c6b76a1
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3252d5b9b2d549b44a5e7f6c348993b3
guid: c9ac3afe988f8554ebd383adb9c1be6b
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: e18126576915f8146af49e3910b4809f
guid: 44145fdb81fcd9b4b956025a0d51421c
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: e7b4b73a0b041314f856b13bf63f0b84
guid: e0f7181ac31efef41b5f38efdb6fa1fe
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 192d548898c01fb43bf53b8e95b9fff3
guid: d4042e7dcbdd7124c8e57e7cdba6720b
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: a1a76cb6763ca8a4ab0450fc989edb19
guid: 10cd137295fa266449e7ed223cce13da
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 13d48294147f7454e9ca4e4d075bcd04
guid: d366813a23b3e7f4396c1063dd92e146
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: c454080d636f840038dc8f37941751b3
guid: 3105329c1bb1f404aaf2ab2323544d93
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 591b223a720c0144daac2de979703d97
guid: d4733684dcead9b4986d77e8789a4f7c
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 80ddf32a802416047aba2ba7b4872768
guid: 3546870499a6d344392704bf4e15ccf2
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 8fb70f3506a535246be122751945de67
guid: fb66f1a2a7cb99644a86e73b6fbc1337
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 8012ff454d5542d42b8e21afcc52ee2f
guid: 1a24f9f4e9e0101428b1632ba1745379
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 9e3f0765f3440a541951dd9223a17825
guid: 69ec60897781d5544a9f9ec595361f51
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 017120279e2244a70b07c667291aca40
guid: 21c0ef1aa214b7f4dbe1ed16a75b8249
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7cb2912222469634ba17a77055919ea8
guid: 75df20a3c0884f047adff6e9ded669da
TrueTypeFontImporter:
serializedVersion: 2
fontSize: 16

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 9a4f8345bee404e36b84d948cd29fb8b
guid: ae9b9966590eea544ab7e5fdd550af81
TextScriptImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a5289e1b1e8a120488785ae4de0f89ee
guid: 0b2dc63813d604f4cba17ca7d4cc7261
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 27d87a15bf86c4159800770927c9aa2f
guid: acd3e356582e4f54b9b077c4e74e3fa0
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 74069a396ef888d4ea96c33784281ac5
guid: 648f9bc0ade48c042be82523552d3454
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 2ac0972e5f0b5439998e30db4f1ab9c3
guid: 5498b4e1b9a138441bd71304db82c72a
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 8934f7763af9e41ee8845ae14c5473f1
guid: e3dc24f2c21f2d14b8ddf700d1e09007
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 35868d7a76dde4354b3ea20c36f8fdf9
guid: bb2ac7565ad7dc74297baefc5b27ed9d
ShaderImporter:
defaultTextures: []
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 3cc66b78ab25c204f9b4d415d02e3abe
guid: 706a4693a901dc14c87d63ae15ef1c38
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f44d0ca8767b76d43a5e1155e7189c0f
guid: db2f7c04eec98684aa4ff95e13d7a7e6
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d8ccdf9e3ac244697bf9b5e32203fa96
guid: fa4a6b45e372f474483f6dd5d72570a3
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 27342824cec2ee64ab208b2396c0d82c
guid: 0e02baad0ca3de544b6738930a776b05
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 879f5ab2d2a90614db855e052b3e2f20
guid: 0b62c3097af092745b834584633b5a41
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3e7439b0348975a43b0dbc4121b11796
guid: 54bc36d9e6f5cb94bb8edd45552f7aa7
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d56722fd7cc841042bfafe48130cf5d8
guid: 634aadfd72be08944b8e878442f6744c
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0ad7c77e77679ab46bf11303c59b229a
guid: 5f647315ec7991440a9aa0c03d8e0081
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dd8c80a5a447f04418da146781b05fd8
guid: 4ab30b4ad3a78b040861d21b78acba8e
ModelImporter:
serializedVersion: 16
fileIDToRecycleName:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2a148c82c5cc8744a812f2f0f3739664
guid: eaa3d72f90429ad4882b8fc2d58a62a2
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 05a81c3d5091440058129444d28322f3
guid: 9aa12c30506fea946b478f3fe6c81a8e
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 8a0cab5ff0a9b465bbc169d7ad27a67f
guid: ec38be38967560e4aa0fbe1cc35b54b9
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 7461a7b0cf97947fd9b9e4502fd2d07b
guid: d284db1bfb3badb4f9a90a8d8d41b411
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: b6a1cf4e3eeaf9a4ca38bf8acb910a6d
guid: 288a66076a67cf644907b7290cb37b9d
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: a93c012dd9ef6454fa7d140e976926f7
guid: 696aa5079f0dc6547b134ffa74041237
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 212619aea848509449704f41e4a1d3f2
guid: 0a2007439f318e94a89af6de36cbd253
NativeFormatImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 1d49f63596dbd412fa2c32ef87fdf2f0
guid: 7d482b73885075a42ab0527b168e38af
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 137fe1b78810a81498d835be344f2d69
guid: 472a95e4bae88de40a978391939597e9
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: e31151469f9db41bb99384b804f43c3d
guid: fece8bc08e2557a469d5782ce5492db6
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 40116c4af15e1444f8e21d1de1f4678f
guid: 39b3acda5b7cb604ea3bccce7eedf291
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 838436750d0cf48a685923371f66cea6
guid: eef53491cfe99af47a7e16491f048d8b
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: 13b46e70f240943ccb1f2665a779f3a6
guid: eff549e8f0f973f4d8a0f49cfb958652
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: f7590198924b11e47b1b33cdd7ec91ac
guid: 067aa9bf31d4ec842bf9310a9327d4a8
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: fa0913115ac1d4fba8b9d10280f4b04d
guid: 85be6d508df860c4191c46f03f5af566
DefaultImporter:
userData:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: d5545059c6381d848ab3d612c68f2669
guid: 7cb135dad0bc5254d9f5e89a88a1ce91
DefaultImporter:
userData:

View File

@@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: de769b24045b0554ab900d313edd10c7
DefaultImporter:
userData:

View File

@@ -1,9 +0,0 @@
using UnityEngine;
using System.Collections;
public class ActiveStateToggler : MonoBehaviour {
public void ToggleActive () {
gameObject.SetActive (!gameObject.activeSelf);
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a95e0a044abfc473394c6c61eb343e4a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,15 +0,0 @@
using UnityEngine;
using System.Collections;
public class ApplicationManager : MonoBehaviour {
public void Quit ()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7696221f0cbbc764498b26fbbf4228af
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,50 +0,0 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ChangeColor : MonoBehaviour, IPointerClickHandler
{
void OnEnable ()
{
}
public void SetRed(float value)
{
OnValueChanged(value, 0);
}
public void SetGreen(float value)
{
OnValueChanged(value, 1);
}
public void SetBlue(float value)
{
OnValueChanged(value, 2);
}
public void OnValueChanged(float value, int channel)
{
Color c = Color.white;
if (GetComponent<Renderer>() != null)
c = GetComponent<Renderer>().material.color;
else if (GetComponent<Light>() != null)
c = GetComponent<Light>().color;
c[channel] = value;
if (GetComponent<Renderer>() != null)
GetComponent<Renderer>().material.color = c;
else if (GetComponent<Light>() != null)
GetComponent<Light>().color = c;
}
public void OnPointerClick(PointerEventData data)
{
if (GetComponent<Renderer>() != null)
GetComponent<Renderer>().material.color = new Color(Random.value, Random.value, Random.value, 1.0f);
else if (GetComponent<Light>() != null)
GetComponent<Light>().color = new Color(Random.value, Random.value, Random.value, 1.0f);
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 71f437cfa250a7d4a9cb2760386ed379
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,88 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class DragMe : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
public bool dragOnSurfaces = true;
private Dictionary<int,GameObject> m_DraggingIcons = new Dictionary<int, GameObject>();
private Dictionary<int, RectTransform> m_DraggingPlanes = new Dictionary<int, RectTransform>();
public void OnBeginDrag(PointerEventData eventData)
{
var canvas = FindInParents<Canvas>(gameObject);
if (canvas == null)
return;
// We have clicked something that can be dragged.
// What we want to do is create an icon for this.
m_DraggingIcons[eventData.pointerId] = new GameObject("icon");
m_DraggingIcons[eventData.pointerId].transform.SetParent (canvas.transform, false);
m_DraggingIcons[eventData.pointerId].transform.SetAsLastSibling();
var image = m_DraggingIcons[eventData.pointerId].AddComponent<Image>();
// The icon will be under the cursor.
// We want it to be ignored by the event system.
var group = m_DraggingIcons[eventData.pointerId].AddComponent<CanvasGroup>();
group.blocksRaycasts = false;
image.sprite = GetComponent<Image>().sprite;
image.SetNativeSize();
if (dragOnSurfaces)
m_DraggingPlanes[eventData.pointerId] = transform as RectTransform;
else
m_DraggingPlanes[eventData.pointerId] = canvas.transform as RectTransform;
SetDraggedPosition(eventData);
}
public void OnDrag(PointerEventData eventData)
{
if (m_DraggingIcons[eventData.pointerId] != null)
SetDraggedPosition(eventData);
}
private void SetDraggedPosition(PointerEventData eventData)
{
if (dragOnSurfaces && eventData.pointerEnter != null && eventData.pointerEnter.transform as RectTransform != null)
m_DraggingPlanes[eventData.pointerId] = eventData.pointerEnter.transform as RectTransform;
var rt = m_DraggingIcons[eventData.pointerId].GetComponent<RectTransform>();
Vector3 globalMousePos;
if (RectTransformUtility.ScreenPointToWorldPointInRectangle(m_DraggingPlanes[eventData.pointerId], eventData.position, eventData.pressEventCamera, out globalMousePos))
{
rt.position = globalMousePos;
rt.rotation = m_DraggingPlanes[eventData.pointerId].rotation;
}
}
public void OnEndDrag(PointerEventData eventData)
{
if (m_DraggingIcons[eventData.pointerId] != null)
Destroy(m_DraggingIcons[eventData.pointerId]);
m_DraggingIcons[eventData.pointerId] = null;
}
static public T FindInParents<T>(GameObject go) where T : Component
{
if (go == null) return null;
var comp = go.GetComponent<T>();
if (comp != null)
return comp;
var t = go.transform.parent;
while (t != null && comp == null)
{
comp = t.gameObject.GetComponent<T>();
t = t.parent;
}
return comp;
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 16adfeb90f2004348b7dfad7eb9ae316
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,48 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
public class DragPanel : MonoBehaviour, IPointerDownHandler, IDragHandler {
private Vector2 originalLocalPointerPosition;
private Vector3 originalPanelLocalPosition;
private RectTransform panelRectTransform;
private RectTransform parentRectTransform;
void Awake () {
panelRectTransform = transform.parent as RectTransform;
parentRectTransform = panelRectTransform.parent as RectTransform;
}
public void OnPointerDown (PointerEventData data) {
originalPanelLocalPosition = panelRectTransform.localPosition;
RectTransformUtility.ScreenPointToLocalPointInRectangle (parentRectTransform, data.position, data.pressEventCamera, out originalLocalPointerPosition);
}
public void OnDrag (PointerEventData data) {
if (panelRectTransform == null || parentRectTransform == null)
return;
Vector2 localPointerPosition;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle (parentRectTransform, data.position, data.pressEventCamera, out localPointerPosition)) {
Vector3 offsetToOriginal = localPointerPosition - originalLocalPointerPosition;
panelRectTransform.localPosition = originalPanelLocalPosition + offsetToOriginal;
}
ClampToWindow ();
}
// Clamp panel to area of parent
void ClampToWindow () {
Vector3 pos = panelRectTransform.localPosition;
Vector3 minPosition = parentRectTransform.rect.min - panelRectTransform.rect.min;
Vector3 maxPosition = parentRectTransform.rect.max - panelRectTransform.rect.max;
pos.x = Mathf.Clamp (panelRectTransform.localPosition.x, minPosition.x, maxPosition.x);
pos.y = Mathf.Clamp (panelRectTransform.localPosition.y, minPosition.y, maxPosition.y);
panelRectTransform.localPosition = pos;
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b895a589a253443a9ac85bafa7402a65
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,65 +0,0 @@
using System.Reflection;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class DropMe : MonoBehaviour, IDropHandler, IPointerEnterHandler, IPointerExitHandler
{
public Image containerImage;
public Image receivingImage;
private Color normalColor;
public Color highlightColor = Color.yellow;
public void OnEnable ()
{
if (containerImage != null)
normalColor = containerImage.color;
}
public void OnDrop(PointerEventData data)
{
containerImage.color = normalColor;
if (receivingImage == null)
return;
Sprite dropSprite = GetDropSprite (data);
if (dropSprite != null)
receivingImage.overrideSprite = dropSprite;
}
public void OnPointerEnter(PointerEventData data)
{
if (containerImage == null)
return;
Sprite dropSprite = GetDropSprite (data);
if (dropSprite != null)
containerImage.color = highlightColor;
}
public void OnPointerExit(PointerEventData data)
{
if (containerImage == null)
return;
containerImage.color = normalColor;
}
private Sprite GetDropSprite(PointerEventData data)
{
var originalObj = data.pointerDrag;
if (originalObj == null)
return null;
var dragMe = originalObj.GetComponent<DragMe>();
if (dragMe == null)
return null;
var srcImage = originalObj.GetComponent<Image>();
if (srcImage == null)
return null;
return srcImage.sprite;
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 266dee177694435468095e35de5218cc
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,96 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
public class PanelManager : MonoBehaviour {
public Animator initiallyOpen;
private int m_OpenParameterId;
private Animator m_Open;
private GameObject m_PreviouslySelected;
const string k_OpenTransitionName = "Open";
const string k_ClosedStateName = "Closed";
public void OnEnable()
{
m_OpenParameterId = Animator.StringToHash (k_OpenTransitionName);
if (initiallyOpen == null)
return;
OpenPanel(initiallyOpen);
}
public void OpenPanel (Animator anim)
{
if (m_Open == anim)
return;
anim.gameObject.SetActive(true);
var newPreviouslySelected = EventSystem.current.currentSelectedGameObject;
anim.transform.SetAsLastSibling();
CloseCurrent();
m_PreviouslySelected = newPreviouslySelected;
m_Open = anim;
m_Open.SetBool(m_OpenParameterId, true);
GameObject go = FindFirstEnabledSelectable(anim.gameObject);
SetSelected(go);
}
static GameObject FindFirstEnabledSelectable (GameObject gameObject)
{
GameObject go = null;
var selectables = gameObject.GetComponentsInChildren<Selectable> (true);
foreach (var selectable in selectables) {
if (selectable.IsActive () && selectable.IsInteractable ()) {
go = selectable.gameObject;
break;
}
}
return go;
}
public void CloseCurrent()
{
if (m_Open == null)
return;
m_Open.SetBool(m_OpenParameterId, false);
SetSelected(m_PreviouslySelected);
StartCoroutine(DisablePanelDeleyed(m_Open));
m_Open = null;
}
IEnumerator DisablePanelDeleyed(Animator anim)
{
bool closedStateReached = false;
bool wantToClose = true;
while (!closedStateReached && wantToClose)
{
if (!anim.IsInTransition(0))
closedStateReached = anim.GetCurrentAnimatorStateInfo(0).IsName(k_ClosedStateName);
wantToClose = !anim.GetBool(m_OpenParameterId);
yield return new WaitForEndOfFrame();
}
if (wantToClose)
anim.gameObject.SetActive(false);
}
private void SetSelected(GameObject go)
{
EventSystem.current.SetSelectedGameObject(go);
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b8960321e10f80b4c844cd91bf1ea437
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,39 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class ResizePanel : MonoBehaviour, IPointerDownHandler, IDragHandler {
public Vector2 minSize = new Vector2 (100, 100);
public Vector2 maxSize = new Vector2 (400, 400);
private RectTransform panelRectTransform;
private Vector2 originalLocalPointerPosition;
private Vector2 originalSizeDelta;
void Awake () {
panelRectTransform = transform.parent.GetComponent<RectTransform> ();
}
public void OnPointerDown (PointerEventData data) {
originalSizeDelta = panelRectTransform.sizeDelta;
RectTransformUtility.ScreenPointToLocalPointInRectangle (panelRectTransform, data.position, data.pressEventCamera, out originalLocalPointerPosition);
}
public void OnDrag (PointerEventData data) {
if (panelRectTransform == null)
return;
Vector2 localPointerPosition;
RectTransformUtility.ScreenPointToLocalPointInRectangle (panelRectTransform, data.position, data.pressEventCamera, out localPointerPosition);
Vector3 offsetToOriginal = localPointerPosition - originalLocalPointerPosition;
Vector2 sizeDelta = originalSizeDelta + new Vector2 (offsetToOriginal.x, -offsetToOriginal.y);
sizeDelta = new Vector2 (
Mathf.Clamp (sizeDelta.x, minSize.x, maxSize.x),
Mathf.Clamp (sizeDelta.y, minSize.y, maxSize.y)
);
panelRectTransform.sizeDelta = sizeDelta;
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bdf784713333a4b24860228711510eac
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,64 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class ScrollDetailTexture : MonoBehaviour
{
public bool uniqueMaterial = false;
public Vector2 scrollPerSecond = Vector2.zero;
Matrix4x4 m_Matrix;
Material mCopy;
Material mOriginal;
Image mSprite;
Material m_Mat;
void OnEnable ()
{
mSprite = GetComponent<Image>();
mOriginal = mSprite.material;
if (uniqueMaterial && mSprite.material != null)
{
mCopy = new Material(mOriginal);
mCopy.name = "Copy of " + mOriginal.name;
mCopy.hideFlags = HideFlags.DontSave;
mSprite.material = mCopy;
}
}
void OnDisable ()
{
if (mCopy != null)
{
mSprite.material = mOriginal;
if (Application.isEditor)
UnityEngine.Object.DestroyImmediate(mCopy);
else
UnityEngine.Object.Destroy(mCopy);
mCopy = null;
}
mOriginal = null;
}
void Update ()
{
Material mat = (mCopy != null) ? mCopy : mOriginal;
if (mat != null)
{
Texture tex = mat.GetTexture("_DetailTex");
if (tex != null)
{
mat.SetTextureOffset("_DetailTex", scrollPerSecond * Time.time);
// TODO: It would be better to add support for MaterialBlocks on UIRenderer,
// because currently only one Update() function's matrix can be active at a time.
// With material block properties, the batching would be correctly broken up instead,
// and would work with multiple widgets using this detail shader.
}
}
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1f55b68dc282796488e1181ab0602967
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,14 +0,0 @@
using System.Reflection.Emit;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Text))]
public class ShowSliderValue : MonoBehaviour
{
public void UpdateLabel (float value)
{
Text lbl = GetComponent<Text>();
if (lbl != null)
lbl.text = Mathf.RoundToInt (value * 100) + "%";
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: acd5fac7403fe184b870fd9b8d0fa262
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,29 +0,0 @@
using UnityEngine;
public class TiltWindow : MonoBehaviour
{
public Vector2 range = new Vector2(5f, 3f);
Transform mTrans;
Quaternion mStart;
Vector2 mRot = Vector2.zero;
void Start ()
{
mTrans = transform;
mStart = mTrans.localRotation;
}
void Update ()
{
Vector3 pos = Input.mousePosition;
float halfWidth = Screen.width * 0.5f;
float halfHeight = Screen.height * 0.5f;
float x = Mathf.Clamp((pos.x - halfWidth) / halfWidth, -1f, 1f);
float y = Mathf.Clamp((pos.y - halfHeight) / halfHeight, -1f, 1f);
mRot = Vector2.Lerp(mRot, new Vector2(x, y), Time.deltaTime * 5f);
mTrans.localRotation = mStart * Quaternion.Euler(-mRot.y * range.y, mRot.x * range.x, 0f);
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c5b01eb497714c1449cb2df46eb5ac6f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e3a5123eeaeabcb47b68c25bd63af922
guid: fa95d076a1ca3144cbfc835d2727842d
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2f548ddb7d7b841a6b8a20693ef7a74b
guid: ca257616b0a1be24c886093149c0e334
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2b4a1682166e4434e8ee7c6f47115b43
guid: bd059c8fbb9f9ce469ae3170a1922eeb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: be0d6a45537a1a64e9e6c4ce47a2d58a
guid: 7e57d5fa69c9b4a4f84dafaf23433967
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fccea209f9ea7b1488225287813f4e38
guid: 924db3b5be50fc04ea6721ae9e9c9e5b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e484876f0cfbe8d46981ae0062b5e77f
guid: a6a573d92c3dc2a48a324f9a2e94d94f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1182605a67e89c34996a4dff4126aa0c
guid: 2b24b229a2353784ebd9b473a1780ca5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6610ac4b8457346ea809f21b89d27cce
guid: 53f8b039e508dce4a96601e3938df674
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 50ab5eea3a58b4ddeb99f0388a1d77c5
guid: c0fea26eb9efc7d47b5a9f795cc58950
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 022a5dbc82be311428eec45125477996
guid: 9ffa1567d66342c45ac585df820fa019
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 30db500b226a8014e82f9e1e39a78e15
guid: 06114da6948e7d34e98cf346b03d02a0
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 38a596ccbd20144369ac06fcbc2ce118
guid: 6f2e0a86889408c4fa0f88cf2ad89080
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 91207f32a007d429180caa8fce010afd
guid: 84ee08f47876ed44c87c0268ccc7967b
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5d5b9ba23399f4d4f8de62cb70b9440f
guid: 272c005fac4937041851a9d3b28a8dd2
TextureImporter:
serializedVersion: 2
mipmaps:

View File

@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: b0eb721fa5d008e4283a54ab605d0bf4
guid: 36401a606754d33468a853f5f7086569
NativeFormatImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 04b3957d8ef9547418f259e4030ede00
guid: 0626bc90ccecace4692110bb1a1dc85d
folderAsset: yes
DefaultImporter:
userData:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f4c899d39b015484a9b4e5464802e401
guid: 68b06eafce51b3b439fc99961b5af574
TextureImporter:
internalIDToNameTable:
- first:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 967c7b47090d34cf090c40749e45f0b4
guid: d71ba1f27bfe07e4dab2bb9ea352e500
TextureImporter:
internalIDToNameTable:
- first:

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 935962ddb1e44499dad00e5ca6b38823
guid: ae41f8d507ceb1a4dab9481eae09b5ed
TextureImporter:
internalIDToNameTable:
- first:

Some files were not shown because too many files have changed in this diff Show More