Exemple #1
0
    public bool StartGameValidation()
    {
        if (_userPlayer == null)
        {
            //New User
            GoToStartScene();
            return(false);
        }
        //Set Location Values
        var locationHelper = LocationHelper.Instance();
        var loc            = locationHelper.GetLocation();

        _userPlayer.Latitude  = loc.x;
        _userPlayer.Longitude = loc.y;
        _terrainDatabase.SetRegion(_userPlayer.Latitude, _userPlayer.Longitude);
        if (DateTime.Now < _userPlayer.GetLockUntil())
        {
            //Lock User
            print("UserPlayer is Locked now = " + Convert.ToDateTime(_userPlayer.LastLogin) + "(" + DateTime.Now + ") (" + _userPlayer.GetLastLogin() + ")"
                  + "AddMinutes = " + _userPlayer.LockMins
                  + "LockUntil = " + Convert.ToDateTime(_userPlayer.LockUntil) + "(" + _userPlayer.GetLockUntil() + ")");
            GoToWaitScene();
            return(false);
        }
        _userPlayer.LockMins = 0;
        SaveUserPlayer(_userPlayer);
        Debug.Log("UD-UserPlayer Verified  = " + _userPlayer.MyInfo());

        if (_characterSetting == null)
        {
            throw new Exception("UDB-Character Setting doesn't Exists!!!");
        }
        if (_characterSetting.Id == 0)
        {
            //No active character
            GoToStartScene();
            return(false);
        }
        if (!_characterSetting.Alive)
        {
            //Dead active character
            SceneManager.LoadScene(SceneSettings.SceneIdForGameOver);
            return(false);
        }
        return(true);
    }
Exemple #2
0
    void Start()
    {
        Debug.Log("***CM*** Start!");
        _canvas = GameObject.Find("Canvas");
        //UserPlayer
        UserPlayer = _userDatabase.GetUserPlayer();
        if (UserPlayer != null)
        {
            Debug.Log("CM-UserPlayer = " + UserPlayer.MyInfo());
        }
        AllUserPlayer = _userDatabase.GetAllUserPlayers();
        Debug.Log("CM-AllUserPlayer.Count = " + AllUserPlayer.Count);
        //CharacterSetting
        CharacterSetting = _userDatabase.GetCharacterSetting();
        if (CharacterSetting != null)
        {
            Debug.Log("CM-CharacterSetting = " + CharacterSetting.MyInfo());
            SetMyCharacter(CharacterSetting.CharacterId);
        }
        //Character
        MyCharacters     = _userDatabase.GetMyCharacters();
        MyUserCharacters = _userDatabase.GetMyUserCharacters();
        Debug.Log("CM-UserCharacters.Count = " + MyCharacters.Count);
        Debug.Log("CM-MyUserCharacters.Count = " + MyUserCharacters.Count);
        //Research
        Researches           = _characterDatabase.GetResearches();
        CharacterResearches  = _userDatabase.GetCharacterResearches();
        CharacterResearching = _userDatabase.GetCharacterResearching();
        //Recipes
        UserRecipes   = _userDatabase.GetMyRecipes();
        MyUserRecipes = _userDatabase.GetMyUserRecipes();
        Debug.Log("CM-UserRecipes.Count = " + UserRecipes.Count);
        Debug.Log("CM-MyUserRecipes.Count = " + MyUserRecipes.Count);
        //Inventory
        InitUserInventory();
        Debug.Log("CM-CharacterInventory.Count = " + CharacterInventory.Count);
        CharacterMixture = _userDatabase.GetCharacterMixture();
        //MailMessages
        MailMessages = _userDatabase.GetMailMessages();
        Debug.Log("CM-MailMessages.Count = " + MailMessages.Count);

        if (CharacterSetting != null)
        {
            LoginCalculations();
        }
    }
Exemple #3
0
    internal string MyInfo()
    {
        string info = "Action =" + Action + " HealthCheck=" + HealthCheck;

        if (UserPlayer.Id != 0)
        {
            info += " UserPlayer=" + UserPlayer.MyInfo();
        }
        if (CharacterSetting.Id != 0)
        {
            info += " CharacterSetting=" + CharacterSetting.MyInfo();
        }
        if (CharacterMixture.Id != 0)
        {
            info += " CharacterMixture=" + CharacterMixture.MyInfo();
        }
        if (CharacterResearching.Id != 0)
        {
            info += " CharacterResearching=" + CharacterResearching.MyInfo();
        }
        if (CharacterResearch.Id != 0)
        {
            info += " CharacterResearch=" + CharacterResearch.MyInfo();
        }
        if (UserRecipe.Id != 0)
        {
            info += " UserRecipe=" + UserRecipe.MyInfo();
        }
        if (UserInventory.Id != 0)
        {
            info += " UserInventory=" + UserInventory.MyInfo();
        }
        if (MailMessage.Id != 0)
        {
            info += " MailMessage=" + MailMessage.MyInfo();
        }
        return(info);
    }
Exemple #4
0
    internal string MyInfo()
    {
        string info = " Message=" + Message;

        if (UserId != 0)
        {
            info += " UserId=" + UserId;
        }

        if (Items.Count != 0)
        {
            info += " Items=" + Items.Count;
        }
        if (Recipes.Count != 0)
        {
            info += " Recipes=" + Recipes.Count;
        }
        if (Offers.Count != 0)
        {
            info += " Offers=" + Offers.Count;
        }

        if (Characters.Count != 0)
        {
            info += " Characters=" + Characters.Count;
        }
        if (Researches.Count != 0)
        {
            info += " Researches=" + Researches.Count;
        }

        if (Regions.Count != 0)
        {
            info += " Terrains=" + Regions.Count;
        }
        if (Terrains.Count != 0)
        {
            info += " Terrains=" + Terrains.Count;
        }
        if (Elements.Count != 0)
        {
            info += " Elements=" + Elements.Count;
        }
        if (InsideStories.Count != 0)
        {
            info += " InsideStories=" + InsideStories.Count;
        }

        if (UserPlayer != null)
        {
            info += " UserPlayer=" + UserPlayer.MyInfo();
        }
        if (UserPlayers.Count != 0)
        {
            info += " UserPlayers=" + UserPlayers.Count;
        }
        if (UserInventory.Count != 0)
        {
            info += " UserInventory=" + UserInventory.Count;
        }
        if (UserCharacters.Count != 0)
        {
            info += " UserCharacters=" + UserCharacters.Count;
        }
        if (CharacterMixture.Id != 0)
        {
            info += " CharacterMixture=" + CharacterMixture.MyInfo();
        }
        if (CharacterResearches.Count != 0)
        {
            info += " CharacterResearches=" + CharacterResearches.Count;
        }
        if (CharacterResearching.Id != 0)
        {
            info += " CharacterResearching=" + CharacterResearching.MyInfo();
        }
        if (CharacterSetting.Id != 0)
        {
            info += " CharacterSetting=" + CharacterSetting.MyInfo();
        }
        if (UserRecipes.Count != 0)
        {
            info += " UserRecipes=" + UserRecipes.Count;
        }
        if (MailMessages.Count != 0)
        {
            info += " MailMessages=" + MailMessages.Count;
        }
        return(info);
    }