Skip to content

Commit

Permalink
-Items
Browse files Browse the repository at this point in the history
-Buildings framework
-main Buildig
-building UI
-Dual Inventory
  -Prefabs
  -UI
  -Transfer
-Inpt handler
  -Mine button (M)
-Code Map (Awesome!!)
  -Inventory (E)
  • Loading branch information
dpeter99 committed Aug 7, 2015
1 parent e5cdd1c commit 6db9809
Show file tree
Hide file tree
Showing 125 changed files with 2,885 additions and 208 deletions.
17 changes: 17 additions & 0 deletions Assets/Behaviour.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using UnityEngine;
using System.Collections;

public class Behaviour : MonoBehaviour {

public GameController GameCon;

// Use this for initialization
void Start () {
GameCon = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
}

// Update is called once per frame
void Update () {

}
}
12 changes: 12 additions & 0 deletions Assets/Behaviour.cs.meta

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

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


public class BuildingBehaviour : MonoBehaviour
{
public Building properties;

void OnMouseDown()
{ }
}
12 changes: 12 additions & 0 deletions Assets/BuildingBehaviour.cs.meta

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

1,183 changes: 1,183 additions & 0 deletions Assets/CodeMap1.dgml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Assets/CodeMap1.dgml.meta

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

9 changes: 9 additions & 0 deletions Assets/GUI.meta

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

6 changes: 5 additions & 1 deletion Assets/GUIHandler.cs → Assets/GUI/GUIHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ public class GUIHandler : MonoBehaviour
{

public InventoryDesplay InventoryDisplay;
public DualInventoryDesplay DualInventory;

public GameObject actionGroup;

public ActionButton[] actions = new ActionButton[10];

public bool inventoryOn;
public bool dualinventoryOn;

// Use this for initialization
void Start()
Expand All @@ -19,7 +23,7 @@ void Start()
for (int i = 0; i < ac.transform.childCount; i++)
{
GameObject go = ac.transform.GetChild(i).gameObject;
actions[i] = go.AddComponent<ActionButton>();
//actions[i] = go.AddComponent<ActionButton>();
}

}
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions Assets/GUI/Inventory/Dual.meta

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

265 changes: 265 additions & 0 deletions Assets/GUI/Inventory/Dual/DualInventoryDesplay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

public class DualInventoryDesplay : MonoBehaviour
{


public GameObject InventoryCanvasPlayer;
public GameObject InventoryCanvasOther;


public GameObject InventoryDubleElement;

public GameObject[] drawedInvPlayer = new GameObject[10];
public GameObject[] drawedInvOther = new GameObject[10];

DualInventoryElement InventoryDravedElement;

Inventory player;
Inventory other;

void Awake()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().Inventory;
}

void Update()
{
UpdateInventory();
}

public void UpdateInventory()
{
#region player inventory

Inventory inv = player;

GameObject drawingCanvas = InventoryCanvasPlayer.transform.FindChild("Items").gameObject;
GameObject[] drawedInv = drawedInvPlayer;

for (int i = 0; i < inv.size; i++)
{
if (inv.inventory[i] != null)
{

if (drawedInv[i] == null)
{
#region setup all
#region setup part
InventoryDravedElement = null;
InventoryDravedElement = Instantiate(InventoryDubleElement).GetComponent<DualInventoryElement>();
InventoryDravedElement.transform.SetParent(drawingCanvas.transform);
#endregion
InventoryDravedElement.Set(inv.inventory[i]);
drawedInv[i] = InventoryDravedElement.gameObject;
drawedInv[i].GetComponent<DualInventoryElement>().isPlayer = true;
drawedInv[i].GetComponent<DualInventoryElement>().other = other;
drawedInv[i].GetComponent<DualInventoryElement>().thisinv = player;
drawedInv[i].GetComponent<DualInventoryElement>().index = i;

Debug.Log(inv.inventory[i].GetType());
Debug.Log("Drawed " + i);
#endregion
}
else
{
InventoryDravedElement = drawedInv[i].GetComponent<DualInventoryElement>();
InventoryDravedElement.Set(inv.inventory[i].amount);
//Debug.Log(inv.inventory[i].GetType() + " " + InventoryDravedElement.name);
//Debug.Log("Drawed " + i);
}
}
else
{
if (drawedInv[i] != null)
{
Destroy(drawedInv[i]);
drawedInv[i] = null;
}
}
}
#endregion


#region other inventory

inv = other;

drawingCanvas = InventoryCanvasOther.transform.FindChild("Items").gameObject;
drawedInv = drawedInvOther;

for (int i = 0; i < inv.size; i++)
{
if (inv.inventory[i] != null)
{

if (drawedInv[i] == null)
{
#region setup part
InventoryDravedElement = null;
InventoryDravedElement = Instantiate(InventoryDubleElement).GetComponent<DualInventoryElement>();
InventoryDravedElement.transform.SetParent(drawingCanvas.GetComponent<RectTransform>());

InventoryDravedElement.Set(inv.inventory[i]);
drawedInv[i] = InventoryDravedElement.gameObject;
drawedInv[i].GetComponent<DualInventoryElement>().isPlayer = false;
drawedInv[i].GetComponent<DualInventoryElement>().other = player;
drawedInv[i].GetComponent<DualInventoryElement>().thisinv = other;
drawedInv[i].GetComponent<DualInventoryElement>().index = i;

Debug.Log(inv.inventory[i].GetType());
Debug.Log("Drawed " + i);
#endregion
}
else
{
#region change part
InventoryDravedElement = drawedInv[i].GetComponent<DualInventoryElement>();
InventoryDravedElement.Set(inv.inventory[i].amount);
//Debug.Log(inv.inventory[i].GetType() + " " + InventoryDravedElement.name);
//Debug.Log("Drawed " + i);
#endregion
}
}
else
{
if (drawedInv[i] != null)
{
Destroy(drawedInv[i]);
drawedInv[i] = null;
}
}
}
#endregion
}


public void UpdateInventory(Inventory inv, int num)
{
GameObject drawingCanvas = InventoryCanvasPlayer;
GameObject[] drawedInv = drawedInvPlayer;
if (inv.inventory[num] != null)
{

if (drawedInv[num] == null)
{

//invDwrEl = drawedInv[i].GetComponent<InventoryDrawedElement>();

Debug.Log("Drawed " + num);

InventoryDravedElement = null;
InventoryDravedElement = Instantiate(InventoryDubleElement).GetComponent<DualInventoryElement>();
InventoryDravedElement.transform.SetParent(drawingCanvas.transform);
Debug.Log(inv.inventory[num].GetType());

InventoryDravedElement.Set(inv.inventory[num]);

drawedInv[num] = InventoryDravedElement.gameObject;
}
else
{
InventoryDravedElement.Set(inv.inventory[num]);
}
}
}

public void DesplayInventory(Inventory player, Inventory other)
{

Inventory inv = player;
GameObject drawingCanvas = InventoryCanvasPlayer;
GameObject[] drawedInv = drawedInvPlayer;

#region player inventory drawing
for (int i = 0; i < inv.size; i++)
{
if (inv.inventory[i] != null)
{

if (drawedInv[i] == null)
{

InventoryDravedElement = null;
InventoryDravedElement = Instantiate(InventoryDubleElement).GetComponent<DualInventoryElement>();
InventoryDravedElement.transform.SetParent(InventoryCanvasPlayer.transform);


InventoryDravedElement.Set(inv.inventory[i]);

drawedInv[i] = InventoryDravedElement.gameObject;
Debug.Log(inv.inventory[i].GetType());
Debug.Log("Drawed " + i);
}
else
{
InventoryDravedElement = drawedInv[i].GetComponent<DualInventoryElement>();
InventoryDravedElement.Set(inv.inventory[i].amount);
Debug.Log(inv.inventory[i].GetType() + " " + InventoryDravedElement.name);
Debug.Log("Drawed " + i);
}
}
}
#endregion

inv = other;
drawingCanvas = InventoryCanvasOther;
drawedInv = drawedInvOther;


#region Other inventory drawing
for (int i = 0; i < inv.size; i++)
{
if (inv.inventory[i] != null)
{

if (drawedInv[i] == null)
{

InventoryDravedElement = null;
InventoryDravedElement = Instantiate(InventoryDubleElement).GetComponent<DualInventoryElement>();
InventoryDravedElement.transform.SetParent(InventoryCanvasPlayer.transform);


InventoryDravedElement.Set(inv.inventory[i]);

drawedInv[i] = InventoryDravedElement.gameObject;
Debug.Log(inv.inventory[i].GetType());
Debug.Log("Drawed " + i);
}
else
{
InventoryDravedElement = drawedInv[i].GetComponent<DualInventoryElement>();
InventoryDravedElement.Set(inv.inventory[i].amount);
Debug.Log(inv.inventory[i].GetType() + " " + InventoryDravedElement.name);
Debug.Log("Drawed " + i);
}
}
}
#endregion

}

public void SetOtherInv(Inventory OtherInventory)
{
other = OtherInventory;
if (OtherInventory != null)
{
drawedInvOther = new GameObject[other.size];
}
else
{
foreach (GameObject des in drawedInvOther)
{
Destroy(des);
}
}
}



}
12 changes: 12 additions & 0 deletions Assets/GUI/Inventory/Dual/DualInventoryDesplay.cs.meta

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

Loading

0 comments on commit 6db9809

Please sign in to comment.