Example #1
1
 internal static void BeginScrollView(Rect position, Vector2 scrollPosition, Rect viewRect, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar)
 {
     s_ScrollPos = scrollPosition;
     s_ViewRect = viewRect;
     s_Position = position;
     GUIClip.Push(position, new Vector2(Mathf.Round((-scrollPosition.x - viewRect.x) - ((viewRect.width - position.width) * 0.5f)), Mathf.Round((-scrollPosition.y - viewRect.y) - ((viewRect.height - position.height) * 0.5f))), Vector2.zero, false);
 }
Example #2
0
    void OnGUI()
    {
        GUIStyle buttonStyle = new GUIStyle();
        buttonStyle.normal.background = null;

        GUIStyle designStyle = new GUIStyle();

        //Top and Bottom middle frame
        GUI.DrawTexture(new Rect(0, 0, Screen.width, 128), FrameTopMiddle_KD);
        GUI.DrawTexture(new Rect(0, Screen.height - 128, Screen.width, 128), FrameBottomMiddle_KD);

        //Left and Right middle frame
        GUI.DrawTexture(new Rect(0, 0, 128, Screen.height), FrameLeft_KD);
        GUI.DrawTexture(new Rect(Screen.width - 128, 0, 128, Screen.height), FrameRight_KD);

        //Frame corners
        GUI.Box(new Rect(Screen.width - 128, 0, 128, 128), FrameTopRight_KD, designStyle);
        GUI.Box(new Rect(0, 0, 128, 128), FrameTopLeft_KD, designStyle);
        GUI.Box(new Rect(Screen.width - 128, Screen.height - 128, 128, 128), FrameBottomRight_KD, designStyle);
        GUI.Box(new Rect(0, Screen.height - 128, 128, 128), FrameBottomLeft_KD, designStyle);

        GUI.Box(new Rect(0, 0, 1024, 1024), FrameMoon_KD, designStyle);
        GUI.Box(new Rect(100, 0, 512, 128), ButtonsBG_KD, designStyle);

        GUI.Box(new Rect(Screen.width - 256, 0, 256, 64), Logo_KD, designStyle);

        //Energy Bar
        //GUI.DrawTexture(new Rect(Screen.width - 33, Screen.height - 232, 30, 200 * .5f), EnergyBarBW_KD, ScaleMode.ScaleAndCrop);
        //GUI.Box(new Rect(Screen.width - 33, Screen.height - 232, 30, 200), EnergyBar_KD, designStyle);
        //GUI.DrawTexture(new Rect(Screen.width - 33, Screen.height - 232, 25, 200 - PowerLevel * 200 / 100), EnergyBarBW_KD, ScaleMode.ScaleAndCrop);
        //GUI.Box(new Rect(Screen.width - 33, Screen.height - 232, 30, 200 * .5f), EnergyBarBW_KD, designStyle);
    }
 void Start()
 {
     this.labelStyle = new GUIStyle();
     this.labelStyle.fontSize = Screen.height / 22;
     this.labelStyle.normal.textColor = Color.white;
     //start_gyro = StartCameraController.ini_gyro;
 }
Example #4
0
    void Start()
    {
        _img = (Texture2D)Resources.Load("bg1");
        _img2 = (Texture2D)Resources.Load("bg2");

        style = new GUIStyle();

        style.font = (Font)Resources.Load("Fonts/Arial");

        style.active.background = _img2; // not working
        style.hover.background = _img2; // not working
        style.normal.background = _img; // not working

        style.active.textColor = Color.red; // not working
        style.hover.textColor = Color.blue; // not working
        style.normal.textColor = Color.white;

        int border = 30;

        style.border.left = border; // not working, since backgrounds aren't showing
        style.border.right = border; // ---
        style.border.top = border; // ---
        style.border.bottom = border; // ---

        style.stretchWidth = true; // ---
        style.stretchHeight = true; // not working, since backgrounds aren't showing

        style.alignment = TextAnchor.MiddleCenter;
    }
    void OnEnable()
    {
		displayManager = target as RUISDisplayManager;
		
        displays = serializedObject.FindProperty("displays");
		ruisMenuPrefab = serializedObject.FindProperty("ruisMenuPrefab");
		
		guiX = serializedObject.FindProperty("guiX");
		guiY = serializedObject.FindProperty("guiY");
		guiZ = serializedObject.FindProperty("guiZ");
		guiScaleX = serializedObject.FindProperty("guiScaleX");
		guiScaleY = serializedObject.FindProperty("guiScaleY");
		hideMouseOnPlay = serializedObject.FindProperty("hideMouseOnPlay");
		
		displayManagerLink = new SerializedObject(displayManager);
		guiDisplayChoiceLink = displayManagerLink.FindProperty("guiDisplayChoice");
		
//        allowResolutionDialog = serializedObject.FindProperty("allowResolutionDialog");
        displayPrefab = Resources.Load("RUIS/Prefabs/Main RUIS/RUISDisplay") as GameObject;

        displayBoxStyle = new GUIStyle();
        displayBoxStyle.normal.textColor = Color.white;
        displayBoxStyle.alignment = TextAnchor.MiddleCenter;
        displayBoxStyle.border = new RectOffset(2, 2, 2, 2);
        displayBoxStyle.margin = new RectOffset(1, 0, 0, 0);
        displayBoxStyle.wordWrap = true;

        monoDisplayTexture = Resources.Load("RUIS/Editor/Textures/monodisplay") as Texture2D;
        stereoDisplayTexture = Resources.Load("RUIS/Editor/Textures/stereodisplay") as Texture2D;
		
		menuCursorPrefab = serializedObject.FindProperty("menuCursorPrefab");
		menuLayer = serializedObject.FindProperty("menuLayer");
    }
Example #6
0
	private         void OnSceneGUI    () {
		Ferr2D_Path  path      = (Ferr2D_Path)target;
		GUIStyle     iconStyle = new GUIStyle();
		iconStyle.alignment    = TextAnchor.MiddleCenter;
		
		// setup undoing things
		Undo.RecordObject(target, "Modified Path");
		
        // draw the path line
		if (Event.current.type == EventType.repaint)
			DoPath(path);
		
		// Check for drag-selecting multiple points
		DragSelect(path);
		
        // do adding verts in when the shift key is down!
		if (Event.current.shift && !Event.current.control) {
			DoShiftAdd(path, iconStyle);
		}
		
        // draw and interact with all the path handles
		DoHandles(path, iconStyle);
		
		// update everything that relies on this path, if the GUI changed
		if (GUI.changed) {
			UpdateDependentsSmart(path, false, false);
			EditorUtility.SetDirty (target);
			prevChanged = true;
		} else if (Event.current.type == EventType.used) {
			if (prevChanged == true) {
				UpdateDependentsSmart(path, false, true);
			}
			prevChanged = false;
		}
	}
Example #7
0
    void OnGUI()
    {
        float screenWidth = Screen.width;
        float screenHeight = Screen.height;
        float weapTextHeight = screenHeight * .02f; //4% of total screen height
        float weapImageHeight = screenHeight * .07f;
        float scoreTextHeight = screenHeight * .08f;

        GUIStyle centerStyle = new GUIStyle(GUI.skin.label);
        centerStyle.alignment = TextAnchor.MiddleCenter;
        GUIStyle rightStyle = new GUIStyle(GUI.skin.label);
        rightStyle.alignment = TextAnchor.MiddleRight;
        rightStyle.fontSize = 20;

        GUI.Label(new Rect(105, 5, 50, weapTextHeight), "MAIN", centerStyle);
        GUI.Label(new Rect(225, 5, 50, weapTextHeight), "SUB", centerStyle);

        Texture2D weaponTexture = Resources.Load<Texture2D>("bullet_bill");
        GUI.DrawTexture(new Rect(105, 5 + weapTextHeight, 50, weapImageHeight), weaponTexture, ScaleMode.ScaleToFit, true, 1.0f);

        Texture2D subWeaponTexture = Resources.Load<Texture2D>("thunderbolt");
        GUI.DrawTexture(new Rect(225, 5 + weapTextHeight, 50, weapImageHeight), subWeaponTexture, ScaleMode.ScaleToFit, true, 1.0f);

        Texture2D meterTexture = Resources.Load<Texture2D>("meter");
        GUI.DrawTexture(new Rect(400, 5, 600, scoreTextHeight), meterTexture, ScaleMode.StretchToFill, true, 1.0f);

        GUI.Label(new Rect(screenWidth - 450, 5, 280, scoreTextHeight), "Score: 314159265351337", rightStyle);
    }
Example #8
0
	void OnGUI(){
		GUIStyle style = new GUIStyle ();
		style.fontSize = Mathf.RoundToInt(40*scale);
		style.normal.textColor = Color.white;
		style.alignment = TextAnchor.UpperCenter;
		GUI.Label (new Rect(Screen.width/2 - titleWidth/2, Screen.height * 0.05f*scale, titleWidth, titleHeight), "Word Snack",style);
		
		
		GUIStyle ButtonStyle = new GUIStyle ();
		ButtonStyle.fontSize = Mathf.RoundToInt(32*scale);
		ButtonStyle.normal.textColor = Color.white;
		ButtonStyle.normal.background = buttonBackground;
		ButtonStyle.alignment = TextAnchor.LowerCenter;
		GUI.BeginGroup (new Rect (Screen.width / 2 - buttonWidth/2, Screen.height * 0.5f, buttonWidth, buttonHeight));
		if (GUILayout.Button ("Play", ButtonStyle)) {
			Debug.Log ("Play is pressed");
			Application.LoadLevel(1);
		}
		GUILayout.Button ( "Instructions", ButtonStyle);
		GUILayout.Button ( "About", ButtonStyle);
		GUI.EndGroup ();
		
		Debug.Log (Screen.height);
		Debug.Log (Screen.width);
	}
Example #9
0
 void AgentPanel(Agent agent)
 {
     GUILayout.BeginVertical();
         //GUILayout.Box(agent._name, GUILayout.Height(100f));
         GUILayout.Box(agent._name);
         GUILayout.Label("HP: "+agent.life+"/"+agent.lifeTotal+"  "+"XP: "+agent.skill);
         GUILayout.BeginHorizontal();
          GUILayout.Label("BP:");
          Dictionary<Type, int> typeToCount = new Dictionary<Type, int>();
          Dictionary<Type, Texture> typeToIcon = new Dictionary<Type, Texture>();
          foreach (EObject obj in agent.backpack) {
             if (typeToCount.ContainsKey(obj.GetType()))
                 typeToCount[obj.GetType()] = typeToCount[obj.GetType()] + 1;
             else {
                 typeToCount.Add(obj.GetType(), 1);
                 typeToIcon.Add(obj.GetType(), obj.getIcon());
             }
          }
         foreach (Type type in typeToCount.Keys) {
         GUILayout.BeginHorizontal();
             GUIStyle iconStyle = new GUIStyle();
             iconStyle.margin = new RectOffset(0, 0, 5, 0);
             GUILayout.Label(typeToIcon[type], iconStyle, GUILayout.Width (20), GUILayout.Height (15));
             GUIStyle textStyle = new GUIStyle();
             textStyle.margin = new RectOffset(0, 10, 5, 0);
             textStyle.normal.textColor = Color.white;
             GUILayout.Label(": " + typeToCount[type], textStyle);
         GUILayout.EndHorizontal();
         }
         GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
	// Test Menu
	// Includes SendTag/SendTags and getting the userID and pushToken
	void OnGUI () {
		GUIStyle customTextSize = new GUIStyle("button");
		customTextSize.fontSize = 30;

		GUIStyle guiBoxStyle = new GUIStyle("box");
		guiBoxStyle.fontSize = 30;

		GUI.Box(new Rect(10, 10, 390, 250), "Test Menu", guiBoxStyle);

		if (GUI.Button (new Rect (60, 80, 300, 60), "SendTags", customTextSize)) {
			// You can tags users with key value pairs like this:
            OneSignal.SendTag("UnityTestKey", "TestValue");
			// Or use an IDictionary if you need to set more than one tag.
            OneSignal.SendTags(new Dictionary<string, string>() { { "UnityTestKey2", "value2" }, { "UnityTestKey3", "value3" } });

			// You can delete a single tag with it's key.
            // OneSignal.DeleteTag("UnityTestKey");
			// Or delete many with an IList.
            // OneSignal.DeleteTags(new List<string>() {"UnityTestKey2", "UnityTestKey3" });
		}

		if (GUI.Button (new Rect (60, 170, 300, 60), "GetIds", customTextSize)) {
            OneSignal.GetIdsAvailable((userId, pushToken) => {
				extraMessage = "UserID:\n" + userId + "\n\nPushToken:\n" + pushToken;
			});
		}

		if (extraMessage != null) {
			guiBoxStyle.alignment = TextAnchor.UpperLeft;
			guiBoxStyle.wordWrap = true;
			GUI.Box (new Rect (10, 300, Screen.width - 20, Screen.height - 310), extraMessage, guiBoxStyle);
		}
	}
Example #11
0
    protected new void prepGUIStyles()
    {
        availableGUIStyles = new Dictionary<string, GUIStyle>();

        float targetWidth = 1280f;
        float targetHeight = 800f;
        Vector3 scaleForCurrRes = new Vector3((Screen.width * 1.0f)/targetWidth,(Screen.height * 1.0f)/targetHeight,1f);

        GUIStyle fieldTitleStyle = new GUIStyle(GUI.skin.label);
        fieldTitleStyle.alignment = TextAnchor.MiddleCenter;
        fieldTitleStyle.fontSize = (int) (50 * scaleForCurrRes.x);

        GUIStyle fieldContentStyle = new GUIStyle(GUI.skin.label);
        fieldContentStyle.alignment = TextAnchor.MiddleCenter;
        fieldContentStyle.fontSize = (int) (30 * scaleForCurrRes.x);

        GUIStyle goalTextStyle = new GUIStyle(GUI.skin.label);
        goalTextStyle.alignment = TextAnchor.MiddleLeft;
        goalTextStyle.fontSize = (int) (30 * scaleForCurrRes.x);

        GUIStyle btnStyle = new GUIStyle(GUI.skin.button);
        btnStyle.wordWrap = true;
        btnStyle.normal.textColor = Color.black;

        availableGUIStyles.Add("FieldTitle",fieldTitleStyle);
        availableGUIStyles.Add("FieldContent",fieldContentStyle);
        availableGUIStyles.Add("GoalText",goalTextStyle);
        availableGUIStyles.Add("Button",btnStyle);
        hasInitGUIStyles = true;
    }
Example #12
0
    public JBCStyle()
    {
        bgTexture = new Texture2D(1, 1);
        bgTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.8f));
        bgTexture.Apply();

        HiddenScrollBar = new GUIStyle(GUI.skin.verticalScrollbar);
        HiddenScrollBar.fixedHeight = HiddenScrollBar.fixedWidth = 0;

        boxStyle = new GUIStyle();
        boxStyle.normal.background = bgTexture;
        boxStyle.normal.textColor = Color.white;

        menuStyle = new GUIStyle(GUI.skin.button);
        menuStyle.normal.textColor = Color.white;
        menuStyle.fontSize = MENU_FONT_SIZE;
        menuStyle.fontStyle = FontStyle.Bold;
        menuStyle.normal.textColor = new Color(0.8f, 0.6f, 0f);

        levelToStyle = new Dictionary<ConsoleLevel, GUIStyle>();

        GUIStyle style = MakeLogStyle();
        style.normal.textColor = new Color(0.62f, 0.82f, 0.62f);
        levelToStyle[ConsoleLevel.Debug] = style;
        style = MakeLogStyle();
        style.normal.textColor = new Color(1f, 0.87f, 0.87f);
        levelToStyle[ConsoleLevel.Info] = style;
        style = MakeLogStyle();
        style.normal.textColor = new Color(1f, 0.47f, 0.47f);
        levelToStyle[ConsoleLevel.Warn] = style;
        style = MakeLogStyle();
        style.normal.textColor = new Color(1f, 0.133f, 0.133f);
        levelToStyle[ConsoleLevel.Error] = style;
        levelToStyle[ConsoleLevel.Fatal] = style;
    }
Example #13
0
    void OnGUI()
    {
        if (hide)
            return;

        _consoleStyle = GUI.skin.box;
        _consoleStyle.alignment = TextAnchor.UpperLeft;
        _consoleStyle.fontSize = charSize;

        int lines = 0;
        foreach (char c in _mainText)
            if (c == '\n')
                lines++;

        int maxLines = (int)(containerInfo.height / _consoleStyle.lineHeight);

        if (lines > maxLines)
        {
            string[] separateLines = _mainText.Split ('\n');
            string newMainText = "";

            for(int i= lines - maxLines; i < lines; ++i)
            {
                newMainText += separateLines[i];
                newMainText += "\n";
            }

            _mainText = newMainText;
        }

        GUI.Box (containerInfo, _mainText, _consoleStyle);
    }
Example #14
0
    void OnGUI()
    {
        current = EditorGUILayout.BeginScrollView (current);

        GUIStyle buttonStyle = new GUIStyle ();
        buttonStyle.margin.left = 10;
        buttonStyle.margin.top = 5;

        GUIStyle labelStyle = new GUIStyle (buttonStyle);
        labelStyle.fontSize = 24;

        foreach (var layerWithObject in layerWithObjectList) {
            string layerName = LayerMask.LayerToName (layerWithObject.layer);

            layerWithObject.isOpen = GUILayout.Toggle (layerWithObject.isOpen, layerName, labelStyle);

            if (layerWithObject.isOpen) {
                foreach (var obj in layerWithObject.objectList) {
                    if (GUILayout.Button (obj.name, buttonStyle)) {
                        UnityEditor.EditorGUIUtility.PingObject (obj);
                    }
                }
            }

            GUILayout.Space (16);
        }

        EditorGUILayout.EndScrollView ();
    }
 void OnGUI()
 {
     var windowTop = Screen.height / 2 - windowHeight / 2;
     var windowLeft = Screen.width / 2 - windowWidth / 2;
     greyButton = GUI.skin.button;
     GUI.ModalWindow(GetHashCode(), new Rect(windowLeft, windowTop, windowWidth, windowHeight), OnGUIDialog, "Unity Editor Facebook Login");
 }
Example #16
0
 void OnGUI()
 {
     GUIStyle mgui = new GUIStyle();
     mgui.fontSize = 200;
     if (mode == "main")
         GUI.DrawTexture (getRect(0.1, 0.1, 0.3, 0.1), target);
     else
         GUI.DrawTexture (getRect(0.6, 0.1, 0.3, 0.1), target);
     if (GUI.Button(getRect(0.1, 0.1, 0.3, 0.1), "메인 맵"))
         mode = "main";
     if (GUI.Button(getRect(0.6, 0.1, 0.3, 0.1), "커스텀 맵"))
         mode = "costom";
     for(int y=0;y<2;y++)
     {
         for (int x = 0; x < 5; x++)
         {
             if (GUI.Button(getRect(0.05+0.2*x, 0.3+0.2*y, 0.1, 0.1), (5 * y + x + 1).ToString()))
             {
                 stage = 5 * y + x + 1;
                 StreamWriter sw= new StreamWriter("playinfo.txt");
                 sw.WriteLine(mode);
                 sw.WriteLine(stage.ToString());
                 sw.Close();
                 Application.LoadLevel("game");
             }
         }
     }
     if (GUI.Button(getRect(0.4, 0.8, 0.2, 0.1), "돌아가기"))
         Application.LoadLevel("mainscreen");
 }
Example #17
0
    void OnGUI()
    {
        if (photonView.isMine) {

            listenForLevelUp();

            GUIStyle style = new GUIStyle();
            style.normal.textColor = Color.blue;
            style.fontSize = 20;
            GUILayout.Label("Health: " + sCharacterClass.currentHealth.ToString() + " / "
                + sCharacterClass.maxHealth.ToString(), style);
            GUILayout.Label("Level: " + sCharacterClass.level.ToString(), style);
            GUILayout.Label("xp" + sCharacterClass.experience.ToString() + " / " + sCharacterClass.reqExperience.ToString(), style);

            if(collideWeapon != null)
            {
                GUI.Label(new Rect(10, 200, 300, 20), "Press F to pick up " + collideWeapon.GunID, style);
            }

            if(increaseStat > 0)
            {
                levelUpStats();
            }

        }
    }
    void OnGUI()
    {
        //draw health bar
        m_Rectangle.x = Screen.width/2 - m_RectOffset.x;
        m_Rectangle.y = Screen.height - m_RectOffset.y;
        GUI.DrawTexture(m_Rectangle, m_Background);
        Rect partialRect = m_Rectangle;
        partialRect.width = m_Rectangle.width * (m_CurrentTime/m_WeaponRechargeTime);
        partialRect.x = m_Rectangle.x;
        GUI.DrawTexture(partialRect, m_Foreground);

        //draw label
        m_LabelRect.x = m_Rectangle.x-m_LabelOffset.x;
        m_LabelRect.y = m_Rectangle.y-m_LabelOffset.y;
        GUIStyle labelStyle = new GUIStyle();
        labelStyle.fontStyle = FontStyle.Bold;
        labelStyle.fontSize = 16;
        labelStyle.normal.textColor = Color.white;
        //labelStyle.font.material =
        GUI.Label(m_LabelRect,"Weapon",labelStyle);

        //draw glow
        m_GlowRect.x = Screen.width/2 - m_GlowOffset.x;
        m_GlowRect.y = Screen.height - m_GlowOffset.y;
        GUI.DrawTexture(m_GlowRect, m_Glow);
    }
Example #19
0
 void OnGUI()
 {
     GUIStyle style = new GUIStyle();
     style.normal.textColor = Color.black;
     for (int i = 0; i < helptext.Length; i++)
         GUILayout.Label(helptext[i], style);
 }
Example #20
0
    void OnGUI()
    {
        //以下デバッグUIの表示

        GUIStyle labelStyle = new GUIStyle();
        labelStyle.alignment = TextAnchor.MiddleCenter;
        labelStyle.normal.textColor = Color.white;
        labelStyle.wordWrap = true;
        labelStyle.fontSize = 24;

        var centerX = Screen.width / 2;
        var tabHeight = Screen.height / 20;

        var buttonWidth = Screen.width - (Screen.width / 6);
        var buttonHeight = Screen.height / 15;

        Rect position;
        float yPosition = Screen.height / 3;

        //オファー
        position = new Rect(centerX - (buttonWidth / 2), yPosition, buttonWidth, buttonHeight);
        if (GUI.Button(position, "広告あり シーン1へ")) {
            Application.LoadLevel("SampleScene1");
        }
    }
    // Update GUI
    void OnGUI()
    {
        // Game name
        GUIStyle startStyle = new GUIStyle();
        startStyle.font = scoreFont;
        startStyle.fontSize = 68;
        startStyle.normal.textColor = Color.black;
        startStyle.alignment = TextAnchor.UpperCenter;

        GUI.Label(new Rect((float)Screen.width/2.0f - 50,10,100,20), "ATAULFO HEARTQUEST", startStyle);

        // Press any key
        startStyle.fontSize = 48;

        GUI.Label(new Rect((float)Screen.width/2.0f - 50,Screen.height-Random.Range(100, 102),100,20), "* PRESS ANY KEY *", startStyle);

        // Graphics
        startStyle.fontSize = 20;
        startStyle.alignment = TextAnchor.UpperRight;
        GUI.Label(new Rect(Screen.width-120,Screen.height-200,100,20), "* Baboon Painters *", startStyle);
        GUI.Label(new Rect(Screen.width-120,Screen.height-180,100,20), "lesswanted", startStyle);
        GUI.Label(new Rect(Screen.width-120,Screen.height-160,100,20), "pikolop", startStyle);

        GUI.Label(new Rect(Screen.width-120,Screen.height-120,100,20), "* Music Gorilla *", startStyle);
        GUI.Label(new Rect(Screen.width-120,Screen.height-100,100,20), "maulo", startStyle);
        //GUI.Label(new Rect(Screen.width-120,Screen.height-140,100,20), "Ataulfo", startStyle);

        // Graphics
        startStyle.fontSize = 20;
        startStyle.alignment = TextAnchor.UpperLeft;
        GUI.Label(new Rect(20,Screen.height-200,100,20), "* Code Monkeys *", startStyle);
        GUI.Label(new Rect(20,Screen.height-180,100,20), "octal0", startStyle);
        GUI.Label(new Rect(20,Screen.height-160,100,20), "leosamu", startStyle);
        GUI.Label(new Rect(20,Screen.height-140,100,20), "materod", startStyle);
    }
Example #22
0
// ReSharper disable once UnusedMember.Local
    private void OnGUI()
    {
        if (rowStyle == null)
        {
            rowStyle = new GUIStyle(GUI.skin.button);
            RectOffset margin = rowStyle.margin;
            rowStyle.margin = new RectOffset(margin.left, margin.right, 1, 1);
        }

        GUILayout.BeginArea(new Rect(5, 40, 30, 255), GUI.skin.box);

        if (GUILayout.Button("-")) api.zoom--;

        for (int i = 3; i < 21; i++)
            if (GUILayout.Button("", rowStyle, GUILayout.Height(10))) api.zoom = i;

        if (GUILayout.Button("+")) api.zoom++;

        GUILayout.EndArea();

        GUI.Box(new Rect(5, 5, Screen.width - 10, 30), "");
        GUI.Label(new Rect(10, 10, 100, 20), "Find place:");
        search = GUI.TextField(new Rect(80, 10, Screen.width - 200, 20), search);
        if (Event.current.type == EventType.KeyUp &&
            (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
            api.FindLocation(search);
        if (GUI.Button(new Rect(Screen.width - 110, 10, 100, 20), "Search")) api.FindLocation(search);
    }
Example #23
0
    public static bool List(Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent, GUIContent[] listContent,
	                         GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle)
    {
        int controlID = GUIUtility.GetControlID (popupListHash, FocusType.Passive);
                bool done = false;
                switch (Event.current.GetTypeForControl (controlID)) {
                case EventType.mouseDown:
                        if (position.Contains (Event.current.mousePosition)) {
                                GUIUtility.hotControl = controlID;
                                showList = true;
                        }
                        break;
                case EventType.mouseUp:
                        if (showList) {
                                done = true;
                        }
                        break;
                }

                GUI.Label (position, buttonContent, buttonStyle);
                if (showList) {
                        Rect listRect = new Rect (position.x, position.y, position.width, listStyle.CalcHeight (listContent [0], 1.0f) * listContent.Length);
                        GUI.Box (listRect, "", boxStyle);
                        listEntry = GUI.SelectionGrid (listRect, listEntry, listContent, 1, listStyle);
                }
                if (done) {
                        showList = false;
                }
                return done;
    }
Example #24
0
	void Start () {
		for (int i =1; i< level; i++) {
			sco+=i*100;
		}

		bb = new GUIStyle();
		bb.normal.background = null;    //这是设置背景填充的
		bb.normal.textColor=new Color(1,0,0);   //设置字体颜色的
		bb.fontSize = 50;       //当然,这是字体颜色

		aa = new GUIStyle();
		aa.normal.background = null;    //这是设置背景填充的
		aa.normal.textColor=new Color(1,0,0);   //设置字体颜色的
		aa.fontSize = 30;       //当然,这是字体颜色


		level10.Initial ();
		InitBgSrc ();//动态加载物体
		GameObject heroobj = GameObject.Find ("hero"); //调用脚本background中的地图
		heroscript = (hero10)heroobj.GetComponent (typeof(hero10));

		GameObject moneyobj = GameObject.Find ("enemy"); //调用脚本background中的地图
		moneyscript = (monkey10)moneyobj.GetComponent (typeof(monkey10));

		GameObject startspt = GameObject.Find ("startbtn"); //调用脚本background中的地图
		stspt = (startscript)startspt.GetComponent (typeof(startscript));
	}
    void OnGUI()
    {
        textStyle = new GUIStyle();
        textStyle.fontSize = 100;
        textStyle.normal.textColor = Color.white;
        textStyle.alignment = TextAnchor.MiddleCenter;

        textStyle2 = new GUIStyle();
        textStyle2.fontSize = 70;
        textStyle2.normal.textColor = Color.white;
        textStyle2.alignment = TextAnchor.MiddleCenter;

        textStyle3 = new GUIStyle();
        textStyle3.fontSize = 200;
        textStyle3.normal.textColor = Color.green;
        textStyle3.alignment = TextAnchor.MiddleCenter;

        buttonStyle = new GUIStyle("button");
        buttonStyle.fontSize = 70;

        GUI.Label(new Rect(10, 100, Screen.width, 100), "GAME OVER",textStyle);
        GUI.Label(new Rect(10, 170, Screen.width, 100), "You ran out of Lives!", textStyle2);
        if(GUI.Button(new Rect(Screen.width / 2 - 400 / 2, 300, 400,200),"Restart", buttonStyle))
        {
            Application.LoadLevel("QuizScene");
        }

        if(GUI.Button (new Rect(Screen.width /2 - 200,510,400,50), "Exit"))
        {
            Application.Quit();
        }
    }
    public void Start()
    {
        OnLanguageChanged();
        demomodeIndicator = skin.GetStyle("demomode");

        controller = (DataController)GameObject.Find("ThinkGear").GetComponent(typeof(DataController));
    }
Example #27
0
    void OnGUI()
    {
        //scale.x = Screen.width / nativeResolution.x;
        //scale.y = Screen.height / nativeResolution.y;

        //var previousMatrix = GUI.matrix;
        //GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale);

        float AREA_LEFT = Screen.width - Screen.width / 5;
        float AREA_TOP = 20;
        float AREA_HEIGHT = Screen.height - 60;
        float AREA_WIDTH = Screen.width / 5 - 20;

        GUIStyle wrapStyle = new GUIStyle("Button");
        wrapStyle.wordWrap = true;

        GUI.Box(new Rect(AREA_LEFT, AREA_TOP, AREA_WIDTH, AREA_HEIGHT + 20), "Navigation");

        GUILayout.BeginArea(new Rect(AREA_LEFT, AREA_TOP + 20, AREA_WIDTH, AREA_HEIGHT));

        GUILayout.BeginVertical();

        if (GUILayout.Button("Main Menu", wrapStyle, GUILayout.Height(AREA_HEIGHT / 6.5f))) Application.LoadLevel("Main");
        if (GUILayout.Button("Waypoint Steering", wrapStyle, GUILayout.Height(AREA_HEIGHT / 6.5f))) Application.LoadLevel("WaypointSteering");
        if (GUILayout.Button("Advanced Waypoint Steering", wrapStyle, GUILayout.Height(AREA_HEIGHT / 6.5f))) Application.LoadLevel("AdvancedWaypointSteering");
        if (GUILayout.Button("Evasive Steering", wrapStyle, GUILayout.Height(AREA_HEIGHT / 6.5f))) Application.LoadLevel("EvasiveSteering");
        if (GUILayout.Button("Other Steering", wrapStyle, GUILayout.Height(AREA_HEIGHT / 6.5f))) Application.LoadLevel("OtherSteering");
        if (GUILayout.Button("Group Behaviors", wrapStyle, GUILayout.Height(AREA_HEIGHT / 6.5f))) Application.LoadLevel("GroupBehaviors");

        GUILayout.EndVertical();

        GUILayout.EndArea();

        //GUI.matrix = previousMatrix;
    }
Example #28
0
    float yScale = 24; // How many units the height of the screen is divided into.

    #endregion Fields

    #region Methods

    // Called for rendering and handling GUI events.
    void OnGUI()
    {
        // Background box
        GUI.Box(ScaleUI.MenuBackground(), "");

        // Menu buttons
        // http://answers.unity3d.com/questions/344493/change-font-size-through-script.html
        GUIStyle scaled = new GUIStyle(GUI.skin.button);
        scaled.fontSize = Screen.width / menuScale;
        scaled.font = font;

        if (GUI.Button(ScaleUI.MenuButton1(), "Start", scaled))
        {
            Application.LoadLevel("Game");
        }
        if (GUI.Button(ScaleUI.MenuButton2(), "Word Bank", scaled))
        {
            Application.LoadLevel("Word Bank");
        }
        if (GUI.Button(ScaleUI.MenuButton3(), "Settings", scaled))
        {
            Application.LoadLevel("Main Menu");
        }
        if (GUI.Button(ScaleUI.MenuButton4(), "Credits", scaled))
        {
            Application.LoadLevel("Credits");
        }
    }
    void OnGUI()
    {
        if (isBubbleVisible && CameraCanSee())
        {
            Vector2 position = Camera.main.WorldToScreenPoint(gameObject.transform.position + new Vector3(0, 2.2f, 0));
            GUIStyle gs = new GUIStyle();
            position.y = Screen.height - position.y;
            position.x -= 60;
            gs.alignment = TextAnchor.MiddleCenter;
            gs.font = font;
            gs.fontSize = 12;
            gs.fontStyle = FontStyle.Bold;
            gs.normal.textColor = new Color(0.1f, 0.1f, 0.1f);

            position.x -= 1;
            position.y -= 1;
            GUI.Label(new Rect(position, new Vector2(120, 0)), message, gs);
            position.x += 2;
            GUI.Label(new Rect(position, new Vector2(120, 0)), message, gs);
            position.y += 2;
            GUI.Label(new Rect(position, new Vector2(120, 0)), message, gs);
            position.x -= 2;
            GUI.Label(new Rect(position, new Vector2(120, 0)), message, gs);
            gs.normal.textColor = Color.white;
            position.x += 1;
            position.y -= 1;
            GUI.Label(new Rect(position, new Vector2(120, 0)), message, gs);
        }
    }
Example #30
0
    public static void checkInit()
    {
        if (!initiated)
        {
        #if UNITY_EDITOR
            InputKnob = UnityEditor.AssetDatabase.LoadAssetAtPath (editorPath + "Textures/In_Knob.png", typeof(Texture2D)) as Texture2D;
            OutputKnob = UnityEditor.AssetDatabase.LoadAssetAtPath (editorPath + "Textures/Out_Knob.png", typeof(Texture2D)) as Texture2D;

            Background = UnityEditor.AssetDatabase.LoadAssetAtPath (editorPath + "Textures/background.png", typeof(Texture2D)) as Texture2D;
        #endif

            ConnectionTypes.FetchTypes ();
            NodeTypes.FetchNodes ();

            // Styles
            nodeBox = new GUIStyle (GUI.skin.box);
            nodeBox.normal.background = ColorToTex (new Color (0.5f, 0.5f, 0.5f));
            nodeBox.normal.textColor = new Color (0.7f, 0.7f, 0.7f);

            nodeButton = new GUIStyle (GUI.skin.button);

            nodeLabel = new GUIStyle (GUI.skin.label);
            nodeLabel.normal.textColor = new Color (0.7f, 0.7f, 0.7f);

            nodeLabelBold = new GUIStyle (nodeLabel);
            nodeLabelBold.fontStyle = FontStyle.Bold;
            nodeLabelBold.wordWrap = false;

            initiated = true;
        }
    }
Example #31
0
        void OnGUI()
        {
            if (window == null)
            {
                Init();
            }

            float startX = 5;
            float startY = 5;
            float spaceX = 70;
            float spaceY = 18;
            float width  = 230;
            float height = 17;

            GUIStyle style = new GUIStyle("Label");

            style.fontSize  = 16;
            style.fontStyle = FontStyle.Bold;

            GUIContent cont = new GUIContent("Top-Down Shooter ToolKit (TDSTK)");

            EditorGUI.LabelField(new Rect(startX, startY, 340, 30), cont, style);

            EditorGUI.LabelField(new Rect(startX, startY + 8, 300, height), "__________________________________");

            startY += 30;
            EditorGUI.LabelField(new Rect(startX, startY, width, height), " - Version:");
            EditorGUI.LabelField(new Rect(startX + spaceX, startY, width, height), "1.2 f3");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), " - Release:");
            EditorGUI.LabelField(new Rect(startX + spaceX, startY, width, height), "29 July 2016");

            startY += 15;

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Developed by K.Song Tan");

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), " - Email:");
            EditorGUI.TextField(new Rect(startX + spaceX, startY, width, height), "*****@*****.**");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), " - Twitter:");
            EditorGUI.TextField(new Rect(startX + spaceX, startY, width, height), "SongTan@SongGameDev");

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), " - Website:");
            EditorGUI.TextField(new Rect(startX + spaceX, startY, width, height), "http://www.songgamedev.com/");
            if (GUI.Button(new Rect(startX + spaceX + width + 10, startY, 50, height), "Open"))
            {
                Application.OpenURL("http://www.songgamedev.com");
            }

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), " - Support:");
            EditorGUI.TextField(new Rect(startX + spaceX, startY, width, height), "http://forum.unity3d.com/threads/topdownshooter-toolkit");
            if (GUI.Button(new Rect(startX + spaceX + width + 10, startY, 50, height), "Open"))
            {
                Application.OpenURL("http://bit.ly/1NlxMJC");
            }

            startY += spaceY;
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, 300, height), "        Your feedback are much appreciated!");
            if (GUI.Button(new Rect(startX, startY += spaceY, 300, height), "Please Rate TDSTK!"))
            {
                Application.OpenURL("http://bit.ly/1NDRqCM");
            }
        }