Dear DrSnake,
Thank you for your solution, but isn’t helped.
Please check my project then you will see the problem.
(Click on all icons on the top one after another, you will see the layering problem.)
http://terberendezo.alexbutor.hu
user: a
pass: a
I got this error:
alapterulet.counterAT’ is inaccessible due to its protection level
This is my “B6” users button script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class felhasznalo : MonoBehaviour {
public GUIStyle userStyel;
public GUIStyle userTooltipSytle;
public GUIStyle szoveg;
int counterAT=0;
// string email = "";
// string username = "";
// string password = "";
// string confirm = "";
public enum Menu {
MainMenu,
NewGame,
Continue
}
public Menu currentMenu;
public List<Game> prefabLista = new List<Game>();
// public void AddTarget(Transform savedPrefabTransform){
// prefabLista.Add (new Game());
//
// }
void OnGUI () {
if (counterAT==2)
{
counterAT = counterAT-2;
}
if (GUI.Button (new Rect (Screen.width/2+35, 10, 50, 48), "" ,userStyel))
{
counterAT++;
Debug.Log(counterAT);
}
if (counterAT == 1)
{
GUI.Box (new Rect (Screen.width / 2 - 200, 80, 405, 400), "" ,userTooltipSytle);
GUI.Label(new Rect(Screen.width / 2 - 170, 100, 60, 25), "FELHASZNÁLÓI FELÜLET" ,szoveg);
//// email = GUI.TextField (new Rect (Screen.width / 2 - 60, 135, 250, 25), email, 40);
//// username = GUI.TextField ( new Rect (Screen.width / 2 - 60, 170, 250, 25), username, 40);
//// password = GUI.PasswordField (new Rect (Screen.width / 2 - 60, 205, 250, 25), password, "*"[0], 40);
//// confirm = GUI.PasswordField (new Rect (Screen.width / 2 - 60, 240, 200, 25), confirm, "*"[0], 40);
//
GUI.Label(new Rect(Screen.width / 2 - 170, 380, 60, 25), "Hamarosan elérhető!\n\n" +
"- árkalkulációt készíthet\n" +
"- megrendelését elküldheti\n" +
"- felhasználói adatokat módosíthat" ,szoveg);
// if (GameObject.Find("B1").GetComponent<alapterulet>().counterAT)
// {
// //counterAT=0;
// }
//
//
//// if (GUI.Button (new Rect (Screen.width / 2 - 60, 280, 100, 30), "Belépés")) {
//// Debug.Log(email + " " + username + " " + password + " " + confirm);
//--------------------------------
GUILayout.BeginArea(new Rect(Screen.width / 2 -170,150,200, 300));
// GUILayout.BeginHorizontal();
// GUILayout.FlexibleSpace();
// GUILayout.BeginVertical();
// GUILayout.FlexibleSpace();
if(currentMenu == Menu.MainMenu) {
GUILayout.Box("Térberendezés");
GUILayout.Space(10);
if(GUILayout.Button("ÚJ üres tér")) {
foreach(GameObject AllgameObjectsDelete in GameObject.FindGameObjectsWithTag("Player"))
{
Destroy (AllgameObjectsDelete);
}
currentMenu = Menu.MainMenu;
}
if(GUILayout.Button("Az összeállítás mentése")) {
Game.current = new Game();
currentMenu = Menu.NewGame;
}
if(GUILayout.Button("Korábbi betöltése")) {
SaveLoad.Load();
currentMenu = Menu.Continue;
}
// if(GUILayout.Button("A lista törlése")) {
// SaveLoad.Load();
// Game gameToRemove = SaveLoad.savedGames.First<game>; //Replace with game you want to remove
// if (gameToRemove != null)
// {
// SaveLoad.savedGames.Remove(gameToRemove);
// }
// SaveLoad.Save();
// }
}
else if (currentMenu == Menu.NewGame) {
GUILayout.Box("Személyes adatok");
GUILayout.Space(10);
GUILayout.Label(("Az Ön neve"), szoveg);
Game.current.vezetek.name = GUILayout.TextField(Game.current.vezetek.name, 20);
GUILayout.Label(("Az összeállítás megnevezése"), szoveg);
Game.current.osszeallitas.name = GUILayout.TextField(Game.current.osszeallitas.name, 20);
if(GUILayout.Button("Mentés")) {
//Save the current Game as a new saved Game
GameObject[]go = GameObject.FindGameObjectsWithTag("Player");
foreach(GameObject AllgameObjectsSave in go)
{
// prefabLista.Add (new Game(AllgameObjectsSave.name));
}
// foreach(GameObject AllgameObjectsSave in GameObject.FindGameObjectsWithTag("Player"))
// {
// Game.current.savedPrefabName = AllgameObjectsSave.name;
// prefabLista.Add (new Game(AllgameObjectsSave.name));
// prefabLista.Add (new Game(AllgameObjectsSave.transform));
// Game.current.savedPrefabName = AllgameObjectsSave.name;
// prefabLista.Add (new Game());
// Game.current.savedPrefabName.name = AllgameObjectsSave.name;
// prefabLista.Add(sPName);
// Debug.Log (AllgameObjectsSave.name);
//
// }
SaveLoad.Save();
//Move on to game...
//Application.LoadLevel(1);
currentMenu = Menu.MainMenu;
}
GUILayout.Space(10);
if(GUILayout.Button("Vissza")) {
currentMenu = Menu.MainMenu;
}
}
else if (currentMenu == Menu.Continue) {
GUILayout.Box("Mentés kiválasztása");
GUILayout.Space(10);
foreach(Game g in SaveLoad.savedGames) {
if(GUILayout.Button(g.vezetek.name + " - " + g.osszeallitas.name)) {
foreach(GameObject AllgameObjectsDelete in GameObject.FindGameObjectsWithTag("Player"))
{
Destroy (AllgameObjectsDelete);
}
Game.current = g;
// Instantiate (Resources.Load ("Prefabs/AS-A-8.6-F.E") as GameObject);
// Debug.Log (Game.current.savedPrefabName.name);
// Instantiate (Resources.Load ("Prefabs/"+Game.current.savedPrefabName.name));
//GameObject myObj = Instantiate (myObjects [whichItem]) as GameObject;
//Move on to game...
//Application.LoadLevel(1);
}
}
GUILayout.Space(10);
if(GUILayout.Button("Vissza")) {
currentMenu = Menu.MainMenu;
}
}
// GUILayout.FlexibleSpace();
// GUILayout.EndVertical();
// GUILayout.FlexibleSpace();
// GUILayout.EndHorizontal();
GUILayout.EndArea();
}
}
}