Esempio n. 1
0
    void Awake()
    {
        GUI              = GameObject.FindGameObjectWithTag("GUI");
        displayEditor    = GUI.GetComponent <DisplayEditor> ();
        buttonColour     = GUI.GetComponent <ButtonColour> ();
        gameInstructions = GUI.GetComponent <GameInstructions> ();

        scriptHolder      = GameObject.FindGameObjectWithTag("ScriptHolder");
        teamChecker       = scriptHolder.GetComponent <TeamChecker> ();
        attack            = scriptHolder.GetComponent <Attack> ();
        countryManagement = scriptHolder.GetComponent <CountryManagement> ();
    }
Esempio n. 2
0
    void Awake()
    {
        scriptHolder     = GameObject.FindGameObjectWithTag("ScriptHolder");
        allocateSoldiers = scriptHolder.GetComponent <AllocateSoldiers> ();
        targetCountry    = scriptHolder.GetComponent <TargetCountry> ();
        phases           = scriptHolder.GetComponent <Phases> ();
        armyMovement     = scriptHolder.GetComponent <ArmyMovement> ();
        playerTurn       = scriptHolder.GetComponent <PlayerTurn> ();
        audioFadeOut     = scriptHolder.GetComponent <AudioFadeOut> ();
        teamChecker      = scriptHolder.GetComponent <TeamChecker> ();

        GUI           = GameObject.FindGameObjectWithTag("GUI");
        displayEditor = GUI.GetComponent <DisplayEditor> ();
        buttonColour  = GUI.GetComponent <ButtonColour> ();
    }
Esempio n. 3
0
    void Awake()
    {
        GUI = GameObject.FindGameObjectWithTag("GUI");
        gameInstructions = GUI.GetComponent <GameInstructions> ();
        displayEditor    = GUI.GetComponent <DisplayEditor> ();

        targetingNetwork  = this.GetComponent <TargetingNetwork> ();
        armyManagement    = this.GetComponent <ArmyManagement>();
        countryManagement = this.GetComponent <CountryManagement> ();
        takeControl       = this.GetComponent <TakeControl> ();
        diceRoll          = this.GetComponent <DiceRoll>();
        phases            = this.GetComponent <Phases> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
        targetCountry     = this.GetComponent <TargetCountry> ();
        audioFadeOut      = this.GetComponent <AudioFadeOut> ();
    }
        /// <summary>
        /// Loads the viewer.
        /// Method searches for assemblies constructed with name of data type assembly + extension.
        /// For example, if provided extensions are '.UI.WPF.dll' and '.UI.dll'
        /// and data is of type TLArtifactsCollection from assembly TraceLabSDK.Types.dll,
        /// method will search for TraceLabSDK.Types.WPF.UI.dll and TraceLabSDK.Types.UI.dll in that order
        /// for type TLArtifactsCollectionEditor (namespace of both must be the same)
        /// 
        /// The provided display functions will try to display windows based on their types.
        /// Typically, one will check for Windows Form and the other for Gui specific editor.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="windowTitle">The window title.</param>
        /// <param name="assemblyExtensions">The list of assembly extensions to check; </param>
        /// <param name="displayUnitEditors">The display unit editors.</param>
        /// <param name="error">The error.</param>
        /// <returns></returns>
        public static bool LoadViewer(object data, string windowTitle, string[] assemblyExtensions, DisplayEditor[] displayUnitEditors, out string error)
        {
            bool success = false;
            Type editorType;
            Type dataType = data.GetType();
            error = String.Empty;

            try
            {
                if(GetEditorType(dataType, assemblyExtensions, out editorType)) 
                {
                    ConstructorInfo constructor = editorType.GetConstructor (Type.EmptyTypes);
                    if (constructor != null) 
                    {
                        IWorkspaceUnitEditor createdEditor = (IWorkspaceUnitEditor)constructor.Invoke (null); 
                        createdEditor.Data = data;
                        
                        //try all display functions
                        foreach (DisplayEditor displayFunc in displayUnitEditors)
                        {
                            success = displayFunc(createdEditor, windowTitle);
                            if (success == true)
                            {
                                break;
                            }
                        }
                    }
                }
                else
                {
                    success = false;
                    error = "Editor has not been found for type: " + dataType.FullName;
                }
            }
            catch(Exception ex)
            {
                //format errors if loading was not successful
                StringBuilder builder = new StringBuilder();
                
                builder.AppendLine("Unable to create editor for type: " + dataType.FullName);
                builder.AppendLine(ex.Message);
                
                error = builder.ToString();
            }

            return success;
        }
Esempio n. 5
0
    void Awake()
    {
        territories = GameObject.FindGameObjectWithTag("Territories");
        troopCount  = territories.GetComponent <TroopCount> ();

        GUI = GameObject.FindGameObjectWithTag("GUI");
        gameInstructions = GUI.GetComponent <GameInstructions> ();
        buttonColour     = GUI.GetComponent <ButtonColour> ();
        displayEditor    = GUI.GetComponent <DisplayEditor> ();

        phases            = this.GetComponent <Phases> ();
        countryManagement = this.GetComponent <CountryManagement> ();
        addSoldier        = this.GetComponent <AddSoldier> ();
        linkedTerritories = this.GetComponent <LinkedTerritories> ();
        playerTurn        = this.GetComponent <PlayerTurn> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
    }
Esempio n. 6
0
    void Awake()
    {
        GUI               = GameObject.FindGameObjectWithTag("GUI");
        receiveBonus      = GUI.GetComponent <ReceiveBonus> ();
        gameInstructions  = GUI.GetComponent <GameInstructions> ();
        buttonColour      = GUI.GetComponent <ButtonColour> ();
        openingDeployment = GUI.GetComponent <OpeningDeployment> ();
        endGame           = GUI.GetComponent <EndGame>();
        displayEditor     = GUI.GetComponent <DisplayEditor>();

        territories    = GameObject.FindGameObjectWithTag("Territories");
        territoryCount = territories.GetComponent <TerritoryCount> ();

        playerTurn     = this.GetComponent <PlayerTurn> ();
        deploySoldiers = this.GetComponent <DeploySoldiers> ();
        armyMovement   = this.GetComponent <ArmyMovement> ();
    }
    // Use this for initialization
    void Awake()
    {
        territories    = GameObject.FindGameObjectWithTag("Territories");
        troopCount     = territories.GetComponent <TroopCount> ();
        boardSetUp     = territories.GetComponent <BoardSetUp> ();
        changeCategory = territories.GetComponent <ChangeCatagory> ();

        GUI = GameObject.FindGameObjectWithTag("GUI");
        openingDeployment = GUI.GetComponent <OpeningDeployment> ();
        displayEditor     = GUI.GetComponent <DisplayEditor> ();
        buttonColour      = GUI.GetComponent <ButtonColour> ();

        countryManagement = this.GetComponent <CountryManagement> ();
        playerTurn        = this.GetComponent <PlayerTurn> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
        phases            = this.GetComponent <Phases> ();
        globalFunctions   = this.GetComponent <GlobalFunctions> ();
    }
Esempio n. 8
0
    void Awake()
    {
        countryManagement = this.GetComponent <CountryManagement> ();
        phases            = this.GetComponent <Phases> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
        playerTurn        = this.GetComponent <PlayerTurn> ();
        deploySoldiers    = this.GetComponent <DeploySoldiers> ();
        attack            = this.GetComponent <Attack> ();
        audioFadeOut      = this.GetComponent <AudioFadeOut> ();

        territories = GameObject.FindGameObjectWithTag("Territories");
        troopCount  = territories.GetComponent <TroopCount> ();

        GUI           = GameObject.FindGameObjectWithTag("GUI");
        displayEditor = GUI.GetComponent <DisplayEditor> ();
        receiveBonus  = GUI.GetComponent <ReceiveBonus> ();
        buttonColour  = GUI.GetComponent <ButtonColour> ();
    }
        //********************************************************************************
        // OnInspectorGUI
        //********************************************************************************
        public override void OnInspectorGUI()
        {
            Info.Reset(m_creature_control);

            if (m_creature_debug != null)
            {
                m_creature_control.Display.ShowDebug = m_creature_debug.enabled;
            }
            else
            {
                m_creature_control.Display.ShowDebug = false;
            }

            GUI.changed = false;

            EditorGUILayout.Separator();

            // COCKPIT
            DisplayEditor.Print(m_creature_control);
            InfoEditor.Print(m_creature_control);

            // WIZARD
            //EditorWizard.Print( m_creature_control );

            // ESSENTIALS
            EssentialsEditor.Print(m_creature_control);

            // STATUS
            StatusEditor.Print(m_creature_control);

            // MISSIONS
            MissionsEditor.Print(m_creature_control);

            // INTERACTION
            InteractionEditor.Print(m_creature_control);

            // ENVIRONMENT
            EnvironmentEditor.Print(m_creature_control);

            //BEHAVIOURS
            BehaviourEditor.Print(m_creature_control);

            EditorGUILayout.LabelField(" - ICECreatureControl v" + Info.Version + " - ", EditorStyles.centeredGreyMiniLabel);

            if (m_creature_control.Display.ShowDebug)
            {
                if (m_creature_debug == null)
                {
                    m_creature_debug = m_creature_control.gameObject.AddComponent <ICECreatureControlDebug>();
                }
                else if (m_creature_debug.enabled == false)
                {
                    m_creature_debug.enabled = true;
                }
            }
            else if (m_creature_debug != null)
            {
                m_creature_debug.enabled = false;

                /*
                 * DestroyImmediate( m_creature_control.GetComponent<ICECreatureControlDebug>() );
                 * EditorGUIUtility.ExitGUI();*/
            }

            MarkSceneDirty(m_creature_control);
        }