public static void Init(Dictionary<string,string> headers)
 {
     window = (AddGameWindow) EditorWindow.GetWindow(typeof(AddGameWindow));
     window.net = new ThreadedNet ();
     window.trackHeaders = headers;
 }
Exemple #2
0
    public void OnGUI()
    {
        GUILayout.BeginVertical();


        if (string.IsNullOrEmpty(userkey))
        {
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("User")).x;
            user = EditorGUILayout.TextField("User", user, GUILayout.Width(200));
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("Pass")).x;
            pass = EditorGUILayout.TextField("Pass", pass, GUILayout.Width(200));

            if (GUILayout.Button("Login"))
            {
                login(user, pass);
            }
        }
        else
        {
            if (gameids != null)
            {
                GUILayout.BeginHorizontal();

                EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("Game ")).x;
                int preselected = selectedgame;

                selectedgame = EditorGUILayout.Popup("Game ", selectedgame, gametitles);
                if (GUILayout.Button("+"))
                {
                    AddGameWindow.Init(trackHeaders);
                }

                if (preselected != selectedgame)
                {
                    getGameVersions(gameids [selectedgame]);
                }
                GUILayout.EndHorizontal();
            }
        }


        if (gameVersions != null)
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("Version ")).x;
            selectedGameVersion         = EditorGUILayout.Popup("Version ", selectedGameVersion, gameVersions);
            GUILayout.EndHorizontal();

            currentConfig = configs [selectedGameVersion];

            EditorGUILayout.LabelField("Configuration");
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("Alias")).x;
            currentConfig.Alias         = EditorGUILayout.TextField("Alias", currentConfig.Alias);
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("Score")).x;
            EditorGUILayout.PrefixLabel("Score");
            currentConfig.Score         = EditorGUILayout.TextArea(currentConfig.Score, GUILayout.Height(75));
            EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent("Max Score")).x;
            currentConfig.MaxScore      = EditorGUILayout.IntField("Max Score", currentConfig.MaxScore);
            EditorGUILayout.PrefixLabel("Progress");
            currentConfig.Progress = EditorGUILayout.TextArea(currentConfig.Progress, GUILayout.Height(75));

            if (GUILayout.Button("Save Configuration"))
            {
                saveGameVersion(currentConfig);
            }
        }

        EditorGUILayout.HelpBox("This is the log:\n" + log, MessageType.None);
        GUILayout.EndVertical();
    }
Exemple #3
0
        private async void ExecuteOpenAddGameWindow() {
            Game newGameForJson = null;
            Messenger.Default.Register<AddGameMessage>(this, g => {
                newGameForJson = g.Game;
            });
            var addGameWindow = new AddGameWindow();
            addGameWindow.ShowDialog();

            if (newGameForJson == null) return;
            await GiantBombAPI.AddToJson(newGameForJson);
            var msg = string.Format("{0} added to list.", newGameForJson.Name);
            MessageBox.Show(msg);
            UpdateGamesList();
        } 
 public static void Init(Dictionary <string, string> headers)
 {
     window              = (AddGameWindow)EditorWindow.GetWindow(typeof(AddGameWindow));
     window.net          = new ThreadedNet();
     window.trackHeaders = headers;
 }