Exemple #1
0
 // Start is called before the first frame update
 void Start()
 {
     hs    = this;
     tmpro = GetComponent <TextMeshProUGUI>();
     csf   = content.GetComponent <ContentSizeFitter>();
     vlg   = content.GetComponent <VerticalLayoutGroup>();
 }
    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);
    }
Exemple #3
0
 protected override void ReleaseReferences()
 {
     base.ReleaseReferences();
     scrollView  = null;
     backBtn     = null;
     previousBtn = null;
     _system     = null;
     nextBtn     = null;
 }
Exemple #4
0
 private void ScrollTo(int index)
 {
     _canTransition = false;
     if (_system == null)
     {
         _system = GetSystem <HistorySystem>();
     }
     this.scrollView.DOAnchorPos(-new Vector2(_system.GetItemPosition(index).x, 0), this.transitionSpeed)
     .SetEase(this.transitionEase).OnComplete(() => { _canTransition = true; });
 }
Exemple #5
0
    public Layer(PrismLayer copy, Dictionary <PrismTexture.Tile, TextureSet.Tile> tiles, Editor e)
        : base(copy, tiles, e)
    {
        history = new HistorySystem(this, e);

        foreach (PrismMesh mesh in copy.Meshes)
        {
            AddMesh(new EMesh(mesh, tiles, this, e));
        }
    }
Exemple #6
0
    public Layer(Layer copy)
        : base(copy)
    {
        history = new HistorySystem(this, editor);

        foreach (EMesh m in copy)
        {
            AddMesh(new EMesh(m, this, editor));
        }
    }
    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);
    }
Exemple #8
0
    public PaintAction(IList <EVertex> vertices, IList <ColorHSL> begin, IList <ColorHSL> end, HistorySystem s)
        : base(s)
    {
        paints = new PaintInfo[vertices.Count];

        for (int i = 0; i < vertices.Count; i++)
        {
            paints[i] = new PaintInfo(vertices[i], begin[i], end[i]);
        }
    }
Exemple #9
0
    public bool ContinueDialogue(DialogueNode next)
    {
        if (current is DialogueNodeSplit)
        {
            if (next != null)
            {
                if (next != null && next.insertText == "" && current.insertText != "")
                {
                    next.insertText = current.insertText;
                }
                current = next;
            }
            else
            {
                throw new NoDialogueOptionSelected();
            }

            {
            }
        }
        else if (current != null)
        {
            if (current.holdsEvent && current.info)
            {
                EventSystem.EventSystem.FireEvent(current.GetEvent());
            }
            if (current.isSaved)
            {
                string text = "";
                if (current.isGameMessage)
                {
                    text = "<b>" + "Game" + "</b>" + " : " + current.dialogueText.Replace("_NAME_",
                                                                                          "<color=#0FF>" + current.insertText + "</color>");
                }
                else
                {
                    if (!(namable.GetType() == typeof(Location)))
                    {
                        if (current.nameFrom)
                        {
                            text = "<b>" + namable.name + "</b>" + " : " + current.dialogueText.Replace("_NAME_",
                                                                                                        "<color=#0FF>" + current.nameFrom.name + "</color>");
                        }
                        else
                        {
                            text = "<b>" + namable.name + "</b>" + " : " +
                                   current.dialogueText.Replace("_NAME_",
                                                                "<color=#0FF>" + current.insertText + "</color>");
                        }
                    }
                    else
                    {
                        text = "<b>" + current.dialogueText.Replace("_NAME_",
                                                                    "<color=#0FF>" + current.insertText + "</color>") + "</b>";
                    }
                }

                HistorySystem.GetHistorySystem().addText(text);
            }

            if (current.next != null && current.next.insertText == "" && current.insertText != "")
            {
                current.next.insertText = current.insertText;
            }
            current = current.next;
        }

        if (current == null)
        {
            ClearAllInsertTexts();
            if (dialogueType == DialogueType.NAMABLE_DIALOGUE)
            {
                StopDialogueEvent();
                namable.namableState = Namable.Namable.NAMABLE_STATE.NAMABLE_DIALOGUE_FINISH;
                EventSystem.EventSystem.FireEvent(namable.GetEvent());
            }

            if (dialogueType == DialogueType.IMAGE_DIALOGUE)
            {
                StopDialogueEvent();
                namable.namableState = Namable.Namable.NAMABLE_STATE.IMAGE_DIALOGUE_FINISH;
                EventSystem.EventSystem.FireEvent(namable.GetEvent());
            }

            if (dialogueType == DialogueType.NORMAL_DIALOGUE)
            {
                current = first;

                StopDialogueEvent();

                var entityEvent = CreateInstance <EntityEventInfo>();
                entityEvent.entityEventType = ENTITY_EVENT_TYPE.ENTITY_STOP;
                EventSystem.EventSystem.FireEvent(entityEvent);

                var locationEvent = CreateInstance <LocationEventInfo>();
                locationEvent.location = Game.currentLocation;

                EventSystem.EventSystem.FireEvent(locationEvent);
                return(false);
            }
        }

        return(true);
    }
 public HistoryAction(HistorySystem system)
 {
     this.system = system;
 }
Exemple #11
0
 public CreateAction(IEnumerable <EMesh> m, HistorySystem s)
     : base(s)
 {
     meshes.AddRange(m);
 }
Exemple #12
0
 public CreateAction(EMesh mesh, HistorySystem s)
     : this(new EMesh[] { mesh }, s)
 {
 }
Exemple #13
0
 public Layer(string name, Editor e)
     : base(name, e)
 {
     history = new HistorySystem(this, editor);
 }
    public TranslateAction(IList <EVertex> vertices, IList <Vector2> begin, IList <Vector2> end, HistorySystem s)
        : base(s)
    {
        translates = new TranslateInfo[vertices.Count];

        for (int i = 0; i < vertices.Count; i++)
        {
            translates[i] = new TranslateInfo(vertices[i], begin[i], end[i]);
        }
    }