Exemplo n.º 1
0
    public override void ReceiveEvent(IGameEvent ev)
    {
        if (ev.Name.Replace("\"", "") == "computer publication")
        {
            object otherObj = ev.getParameter(SequenceGenerator.EVENT_OTHER_FIELD);
            string other    = otherObj != null?otherObj.ToString().Replace("\"", "") : "";

            if (other == "save")
            {
                computer.SaveComputerState();
                return;
            }
            if (other == "load")
            {
                computer.LoadComputerState();
                return;
            }

            string publicationKey = ev.getParameter(SequenceGenerator.EVENT_VARIABLE_FIELD).ToString().Replace("\"", "");
            string message        = ev.getParameter(SequenceGenerator.EVENT_VALUE_FIELD).ToString().Replace("\"", "");
            string author         = ev.getParameter(SequenceGenerator.EVENT_KEY_FIELD).ToString().Replace("\"", "");

            float time = (float)ev.getParameter(SequenceGenerator.EVENT_TIME_FIELD);
            StartCoroutine(ExecuteAfterTime(time, author, message, publicationKey, other));
        }
    }