示例#1
0
    public void InitializeGame(APIHandler.ServerData serverData)
    {
        if (!serverData.text.Equals(""))
        {
            HistorySystem.GetHistorySystem().setText(serverData.text);
        }
        else
        {
            StartGameFirstTime();
            return;
        }
        if (serverData.Locations != null)
        {
            foreach (var loc in serverData.Locations)
            {
                Location foundLocation = allLocations.Find(location => location && location.uniqueID == loc.UniqueId);
                if (foundLocation)
                {
                    Namable.Namable.NAMABLE_STATE locState;
                    Enum.TryParse(loc.State, out locState);
                    foundLocation.namableState = locState;

                    foundLocation.name = loc.Name;

                    foundLocation.hideActionsNr   = loc.HideActionNr;
                    foundLocation.hideEntitiesNr  = loc.HideEntityNr;
                    foundLocation.hideLocationsNr = loc.HideLocationNr;

                    foundLocation.imagePath = loc.ImagePath;
                }
            }
        }

        if (serverData.Namables != null)
        {
            foreach (var nam in serverData.Namables)
            {
                Entity foundNamable =
                    allEntities.Find(namable => namable && namable.uniqueID.Equals(nam.UniqueId));
                if (foundNamable)
                {
                    Namable.Namable.NAMABLE_STATE locState;
                    Enum.TryParse(nam.State, out locState);
                    foundNamable.namableState = locState;

                    foundNamable.name          = nam.Name;
                    foundNamable.dialogueState = nam.dialogueState;

                    foundNamable.imagePath = nam.ImagePath;
                }
            }
        }

        GameStartEventInfo gameStartEventInfo = ScriptableObject.CreateInstance <GameStartEventInfo>();

        gameStartEventInfo.progress = serverData.progressIndex;

        EventSystem.EventSystem.FireEvent(gameStartEventInfo);
    }
示例#2
0
 private void HandleStartGameEvent(GameStartEventInfo gameStartEventInfo)
 {
     LocationSystem.Start();
     DialogueSystem.Start();
     EntitySystem.Start();
     ProgressSystem.Start();
     loadingScreen.SetActive(false);
     StartGame(gameStartEventInfo.progress);
 }
示例#3
0
    public void StartGameFirstTime()
    {
        HistorySystem.GetHistorySystem().setText("New Game Started");
        foreach (var namable in alreadyDefined)
        {
            APIHandler.getAPIHandler().UploadEntityData(namable.getUploadData());
        }

        GameStartEventInfo eventInfo = ScriptableObject.CreateInstance <GameStartEventInfo>();

        eventInfo.progress = 0;

        EventSystem.EventSystem.FireEvent(eventInfo);
    }