Esempio n. 1
0
        public static void Set(Form primaryForm, CharacterSelection initialScene)
        {
            host = primaryForm;
            DrivingCharacter = initialScene.CentralCharacter;
            playScene = new PlayScene();
            playScene.Location = new Point(padding, padding);
            playScene.Size = new Size(host.ClientRectangle.Width - padding * 2, host.ClientRectangle.Height - padding * 2);
            host.Resize += host_Resize;
            if(!_eventsInitialized)
            {
                _eventsInitialized = true;
                if (DrivingCharacter.IsGM)
                {
                    host.KeyDown += playScene_DM_KeyDown;
                    playScene.TileSelected += playScene_DM_TileSelected;
                }
                else
                {
                    host.KeyDown += playScene_KeyDown;
                    playScene.TileSelected += playScene_TileSelected;
                }
            }
            playScene.ViewCenterX = initialScene.CentralCharacter.LocationX;
            playScene.ViewCenterY = initialScene.CentralCharacter.LocationY;
            playScene.ViewCenterZ = initialScene.CentralCharacter.LocationZ;

            host.Controls.Add(playScene);
            playScene.Add(initialScene.visibleTiles);
            playScene.Add(initialScene.visibleCharacters);

            Updater = new BackgroundWorker();
            Updater.DoWork += Updater_DoWork;
            Updater.RunWorkerCompleted += Updater_RunWorkerCompleted;
            Updater.RunWorkerAsync();
        }
Esempio n. 2
0
 static void _selectCharacter_Click(object sender, EventArgs e)
 {
     if(_characterList.SelectedItems.Count < 1)
     {
         return;
     }
     string result = Mundasia.Communication.ServiceConsumer.SelectCharacter(_characterList.SelectedItems[0].SubItems[0].Text);
     CharacterSelection ch = new CharacterSelection(result);
     if(ch.CentralCharacter == null || ch.visibleCharacters == null || ch.visibleTiles == null)
     {
         MessageBox.Show("An error has occured. This character selection has resulted in no scene to draw.");
         return;
     }
     Clear(_form);
     PlayerInterface.Set(_form, ch);
 }
Esempio n. 3
0
        public string SelectCharacter(string message)
        {
            RequestCharacter upd = new RequestCharacter(message);
            Account acct = Account.LoadAccount(upd.UserId);
            if(acct == null)
            {
                return String.Empty;
            }
            string ip = (OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty).Address;
            if(acct.SessionId != upd.SessionId || acct.Address != ip)
            {
                return "Error: incorrect address or session Id";
            }
            acct.KeepAlive();

            Character cha = acct.LoadCharacter(upd.RequestedCharacter);
            if (cha != null)
            {
                CharacterSelection ret = new CharacterSelection(cha);
                return ret.ToString();
            }
            return String.Empty;
        }