Beispiel #1
0
 void SessionTimeoutMessage(string text)
 {
     m_buffer = new OutputBuffer(null);
     m_buffer.OutputText(text);
     m_buffer.AddJavaScriptToBuffer("sessionTimeout");
     ClearJavaScriptBuffer();
 }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // We store the game in the Session, but use a dictionary keyed by GUIDs which
            // are stored in the ViewState. This allows the same user in the same browser
            // to open multiple games in different browser tabs.

            if (Games == null)
            {
                Games = new Dictionary<string, PlayerHandler>();
            }

            if (OutputBuffers == null)
            {
                OutputBuffers = new Dictionary<string, OutputBuffer>();
            }

            if (Resources == null)
            {
                Resources = new SessionResources();
            }

            m_gameId = (string)ViewState["GameId"];
            if (m_gameId == null)
            {
                m_gameId = Guid.NewGuid().ToString();
                ViewState["GameId"] = m_gameId;
            }

            if (Page.IsPostBack)
            {
                if (Games.ContainsKey(m_gameId))
                {
                    m_player = Games[m_gameId];
                }

                if (!OutputBuffers.ContainsKey(m_gameId))
                {
                    // TO DO: Think this only ever happens while debugging?
                    return;
                }
                m_buffer = OutputBuffers[m_gameId];
            }
            else
            {
                m_buffer = new OutputBuffer();
                OutputBuffers.Add(m_gameId, m_buffer);

                bool saveVisible = IsLoggedIn && (!string.IsNullOrEmpty(Request["id"]) || !string.IsNullOrEmpty(Request["load"]));
                m_buffer.AddJavaScriptToBuffer("showSaveButton", new BooleanParameter(saveVisible));
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // We store the game in the Session, but use a dictionary keyed by GUIDs which
            // are stored in the ViewState. This allows the same user in the same browser
            // to open multiple games in different browser tabs.

            if (Games == null)
            {
                Games = new Dictionary <string, PlayerHandler>();
            }

            if (OutputBuffers == null)
            {
                OutputBuffers = new Dictionary <string, OutputBuffer>();
            }

            if (Resources == null)
            {
                Resources = new SessionResources();
            }

            m_gameId = (string)ViewState["GameId"];
            if (m_gameId == null)
            {
                m_gameId            = Guid.NewGuid().ToString();
                ViewState["GameId"] = m_gameId;
            }

            if (Page.IsPostBack)
            {
                if (Games.ContainsKey(m_gameId))
                {
                    m_player = Games[m_gameId];
                }

                if (!OutputBuffers.ContainsKey(m_gameId))
                {
                    // TO DO: Think this only ever happens while debugging?
                    return;
                }
                m_buffer = OutputBuffers[m_gameId];
            }
            else
            {
                m_buffer = new OutputBuffer(m_gameId);
                OutputBuffers.Add(m_gameId, m_buffer);
                m_buffer.AddJavaScriptToBuffer("setOutputBufferId", new StringParameter(m_gameId));
            }
        }
        private void SendUpdatedList(ListType listType)
        {
            if (listType == ListType.ExitsList)
            {
                SendCompassList(m_lists[ListType.ExitsList]);
                return;
            }

            string listName = null;

            if (listType == ListType.InventoryList)
            {
                listName = "inventory";
            }
            if (listType == ListType.ObjectsList)
            {
                listName = "placesobjects";
            }

            if (listName != null)
            {
                m_buffer.AddJavaScriptToBuffer("updateList", new StringParameter(listName), PlayerHelper.ListDataParameter(m_lists[listType]));
            }
        }
Beispiel #5
0
        private void RegisterExternalStylesheets()
        {
            var stylesheets = m_player.GetExternalStylesheets();

            if (stylesheets == null)
            {
                return;
            }

            foreach (var stylesheet in stylesheets)
            {
                m_buffer.AddJavaScriptToBuffer("addExternalStylesheet", new StringParameter(stylesheet));
            }
        }
Beispiel #6
0
 void SessionTimeoutMessage(string text)
 {
     m_buffer = new OutputBuffer(null);
     m_buffer.OutputText(text);
     m_buffer.AddJavaScriptToBuffer("sessionTimeout");
     ClearJavaScriptBuffer();
 }
Beispiel #7
0
 void RequestNextTimerTick(int seconds)
 {
     m_buffer.AddJavaScriptToBuffer("requestNextTimerTick", new IntParameter(seconds));
 }