public static User getCurrentUser()
 {
     if (NetworkManager.NetworkInstance.IsServer)
     {
         User admin = Team.GetUser("Admin", 0);
         if (admin != null)
         {
             return(admin);
         }
     }
     else
     {
         UIMainController obj = Object.FindObjectOfType <UIMainController>();
         if (obj.GetUser() != null)
         {
             return(obj.GetUser());
         }
     }
     if (NullUser != null)
     {
         return(NullUser);
     }
     NullUser = new User(PermissionLevel.Spectator, MilitaryBranch.Navy, 0, "Null", null);
     return(NullUser);
 }
Example #2
0
 private void Awake()
 {
     _uiMainController     = transform.parent.GetComponent <UIMainController>();
     _mainController       = GameObject.Find("MainController").GetComponent <MainController>();
     _uiNCounterController = GameObject.Find("NcountrySelectedPanel").GetComponent <UINcounterController>();
     _clearBtn             = transform.Find("ClearListButton").gameObject;
     ClearBtnUnactivate();
 }
    /**
     * Logs the user out and removes them from their current team
     */
    public void Logout()
    {
        //Remove user from team
        UIMainController UIMC = Object.FindObjectOfType <UIMainController>();
        User             user = UIMC.GetUser();

        Team.RemoveUser(user.TeamNumber, user.GetUsername());

        Application.Quit();
    }
    public void ActivateEndTurnSpinner()
    {
        ////Debug.Log("Turn Completed");
        UIMainController UserUI = GameObject.Find("Canvas").GetComponent <UIMainController> ();

        if (UserUI != null)
        {
            UserUI.ShowLog();
        }

        EndOfTurnDisplay.SetActive(true);
        EndOfTurnAnimation.Play();
    }
    public override void HandleEvent(GEvent e)
    {
        //Handle End of Turn

        ////Debug.Log("Handling End of Turn Event");

        //Fire weapons on each ship that have been aimed
        AttackController[] fire = GameObject.FindObjectsOfType(typeof(AttackController)) as AttackController[];

        foreach (AttackController t in fire)
        {
            t.FireWeaponsEvent();
        }

        Controller[] Controllers = MonoBehaviour.FindObjectsOfType(typeof(Controller)) as Controller[];

        foreach (Controller ctrl in Controllers)
        {
            GEvent ge = ctrl.GetEvent();

            if (ge != null)
            {
                EventManager.Instance.AddEvent(ge);
            }
        }

        UIMainController UserUI = GameObject.Find("Canvas").GetComponent <UIMainController> ();

        if (UserUI != null)
        {
            UserUI.ShowLog();
        }
        // Handle all move events
        EventManager.Instance.HandleEvents(1);

        // Handle all attack events
        EventManager.Instance.HandleEvents(2);

        TurnManager.MoveToNextTurn();

        TurnManager.ThrowStartOfTurnEvent();
    }
Example #6
0
 private void Awake()
 {
     m_instance = this;
 }