Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit, migrate from Google Code, r11
  • Loading branch information
Keripo committed Mar 10, 2014
1 parent ca6a266 commit a3127fc
Show file tree
Hide file tree
Showing 464 changed files with 62,890 additions and 340 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Ll]ibrary/
[Tt]emp/
[Oo]bj/

# Autogenerated VS/MD solution and project files
*.csproj
*.unityproj
*.sln
2 changes: 2 additions & 0 deletions Assets/Audio.meta

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

Binary file added Assets/Audio/smooooch.mp3
Binary file not shown.
11 changes: 11 additions & 0 deletions Assets/Audio/smooooch.mp3.meta

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

2 changes: 2 additions & 0 deletions Assets/Editor.meta

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

2 changes: 2 additions & 0 deletions Assets/Editor/Lumos.meta

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

102 changes: 102 additions & 0 deletions Assets/Editor/Lumos/LumosBugReporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright (c) 2012 Rebel Hippo Inc. All rights reserved.

using System;
using System.Net;
using System.Text;
using UnityEditor;
using UnityEngine;

/// <summary>
/// Report issues with Lumos. Open from the Help > Lumos > Report a Bug menu.
/// </summary>
public class LumosBugReporter : EditorWindow
{
static readonly GUIContent emailLabel = new GUIContent("Email", "Your email address (optional).");
static readonly GUIContent issueLabel = new GUIContent("Issue", "Details about the problem you're running into.");
static readonly GUIContent submitLabel = new GUIContent("Submit", "Send your issue.");

static readonly GUIContent sentNotification = new GUIContent("Bug Report Sent\nThanks!");
static readonly GUIContent errorNotification = new GUIContent("An Error Occurred\nBug Report Not Sent");

string email = ""; // Optional
string issue = "";

bool inProgress;
GUIContent currentNotification;

static bool debug = false;

void OnGUI ()
{
EditorGUILayout.BeginHorizontal();

EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(false));
GUILayout.Label(emailLabel);
GUILayout.Label(issueLabel);
EditorGUILayout.EndVertical();

EditorGUILayout.BeginVertical();
email = EditorGUILayout.TextField(email);
issue = EditorGUILayout.TextArea(issue, GUILayout.ExpandHeight(true));

GUI.enabled = issue != "";

if (inProgress) {
// Draw progress bar
// This doesn't accurately reflect the request's progress, but it indicates that something is happening
var rect = GUILayoutUtility.GetRect(submitLabel, GUI.skin.button);
EditorGUI.ProgressBar(rect, 0.4f, "Sending...");
} else {
if (GUILayout.Button(submitLabel)) {
ReportBug();
}
}
EditorGUILayout.EndVertical();

EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();

if (currentNotification != null) {
ShowNotification(currentNotification);
currentNotification = null;
}
}

/// <summary>
/// Asynchronously sends the bug report to the server.
/// </summary>
void ReportBug ()
{
var message = "email=" + email + "&issue=" + issue;
var bytes = Encoding.UTF8.GetBytes(message);

var url = "http://" + (debug ? "localhost:8080" : "www.uselumos.com") + "/report-bug";
var request = WebRequest.Create(url);
request.Method = "POST";
request.ContentLength = bytes.Length;
request.ContentType = "application/x-www-form-urlencoded";

try {
var stream = request.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();
request.BeginGetResponse(new AsyncCallback(ResponseCallback), request);
inProgress = true;
} catch (Exception e) {
if (debug) { Debug.LogError("[Lumos] Bug report not sent. " + e.Message); }
currentNotification = errorNotification;
}
}

/// <summary>
/// Called upon completion of the asynchronous request to the server.
/// </summary>
/// <param name="ar">Asynchronous result.</param>
void ResponseCallback (IAsyncResult ar)
{
var request = (WebRequest)ar.AsyncState;
request.EndGetResponse(ar);
inProgress = false;
currentNotification = sentNotification;
}
}
7 changes: 7 additions & 0 deletions Assets/Editor/Lumos/LumosBugReporter.cs.meta

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

36 changes: 36 additions & 0 deletions Assets/Editor/Lumos/LumosInspector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2012 Rebel Hippo Inc. All rights reserved.

using UnityEditor;
using UnityEngine;

/// <summary>
/// A custom inspector for the Lumos game object.
/// </summary>
[CustomEditor(typeof(Lumos))]
public class LumosInspector : Editor
{
GUIContent secretKeyLabel = new GUIContent("Secret Key", "Your application's secret key.");
GUIContent recordInEditorLabel = new GUIContent("Record While In Editor", "Send data to Lumos during development.");
GUIContent recordPresetEventsLabel = new GUIContent("Record Preset Events", "Record pre-configured events.");
GUIContent recordErrorsLabel = new GUIContent("Record Errors", "Report error messages sent to Unity's console.");
GUIContent recordWarningsLabel = new GUIContent("Record Warnings", "Report warning message sent to Unity's console.");
GUIContent recordLogsLabel = new GUIContent("Record Logs", "Report debug log message sent to Unity's console.");

override public void OnInspectorGUI ()
{
var lumos = target as Lumos;

EditorGUIUtility.LookLikeInspector();
EditorGUI.indentLevel = 1;

lumos.secretKey = EditorGUILayout.TextField(secretKeyLabel, lumos.secretKey);
lumos.runInEditor = EditorGUILayout.Toggle(recordInEditorLabel, lumos.runInEditor);
lumos.recordPresetEvents = EditorGUILayout.Toggle(recordPresetEventsLabel, lumos.recordPresetEvents);

EditorGUILayout.Space();

lumos.recordErrors = EditorGUILayout.Toggle(recordErrorsLabel, lumos.recordErrors);
lumos.recordWarnings = EditorGUILayout.Toggle(recordWarningsLabel, lumos.recordWarnings);
lumos.recordLogs = EditorGUILayout.Toggle(recordLogsLabel, lumos.recordLogs);
}
}
7 changes: 7 additions & 0 deletions Assets/Editor/Lumos/LumosInspector.cs.meta

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

54 changes: 54 additions & 0 deletions Assets/Editor/Lumos/LumosMenus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) 2012 Rebel Hippo Inc. All rights reserved.

using UnityEditor;
using UnityEngine;

/// <summary>
/// Menus for various functionality.
/// </summary>
public static class LumosMenus
{
const string documentationUrl = "http://www.uselumos.com/supports/docs";

/// <summary>
/// Adds "Add To Scene" menu item to the Window menu.
/// This triggers a wizard which prompts the user for their secret key before instantiating the Lumos prefab.
/// </summary>
[MenuItem("GameObject/Create Other/Lumos...")]
static void AddToScene ()
{
ScriptableWizard.DisplayWizard<LumosWizard>("Add Lumos To Scene", "Add", "Cancel");
}

/// <summary>
/// Validates the "Add To Scene" menu item, disabling it if a Lumos instance already exists in the scene.
/// </summary>
/// <returns>Whether or not the menu is enabled.</returns>
[MenuItem("GameObject/Create Other/Lumos...", true)]
static bool ValidateAddToScene ()
{
var go = GameObject.Find("Lumos");
return go == null;
}

/// <summary>
/// Adds link to Lumos website to Help menu.
/// </summary>
[MenuItem("Help/Lumos/Documentation")]
static void DisplayWebsite ()
{
Help.BrowseURL(documentationUrl);
}

/// <summary>
/// Adds menu item to open the Lumos bug reporter.
/// </summary>
[MenuItem("Help/Lumos/Report a Bug")]
static void OpenBugReporter ()
{
// Get existing open window, or make new one if none
var window = EditorWindow.GetWindow<LumosBugReporter>();
window.title = "Report Bug";
window.Show();
}
}
7 changes: 7 additions & 0 deletions Assets/Editor/Lumos/LumosMenus.cs.meta

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

42 changes: 42 additions & 0 deletions Assets/Editor/Lumos/LumosWizard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) 2012 Rebel Hippo Inc. All rights reserved.

using UnityEditor;
using UnityEngine;

/// <summary>
/// A wizard for instantiating the Lumos game object.
/// </summary>
public class LumosWizard : ScriptableWizard
{
const string prefabPath = "Assets/Standard Assets/Lumos/Lumos.prefab";
public string secretKey = "";

/// <summary>
/// Called when the "Create" button is pressed.
/// </summary>
void OnWizardCreate ()
{
Undo.RegisterSceneUndo("Add Lumos To Scene");

// Instantiate the Lumos object
var prefab = Resources.LoadAssetAtPath(prefabPath, typeof(GameObject));
var go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
go.GetComponent<Lumos>().secretKey = secretKey;
}

/// <summary>
/// Called when the "Cancel" button is pressed.
/// </summary>
void OnWizardOtherButton ()
{
Close();
}

/// <summary>
/// UI elements.
/// </summary>
void OnWizardUpdate ()
{
helpString = "Fill in your application's secret key below.";
}
}
7 changes: 7 additions & 0 deletions Assets/Editor/Lumos/LumosWizard.cs.meta

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

2 changes: 2 additions & 0 deletions Assets/Graphics.meta

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

2 changes: 2 additions & 0 deletions Assets/Graphics/Background.meta

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

Binary file added Assets/Graphics/Background/Background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions Assets/Graphics/Background/Background.png.meta

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

Binary file added Assets/Graphics/Background/Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions Assets/Graphics/Background/Icon.png.meta

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

Binary file added Assets/Graphics/Background/Logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a3127fc

Please sign in to comment.