コード例 #1
0
        void EnterWorld()
        {
            _instance.Enter(_configuration.World);

            _instance.UpdateAvatar(_configuration.Position.X, _configuration.Position.Y,
                                   _configuration.Position.Z, _configuration.Rotation.Y, _configuration.Rotation.Z);
            _timer = new Timer(AliveCallBack, null, 0, 0);
        }
コード例 #2
0
ファイル: BaseExampleBot.cs プロジェクト: mesh42/vpnet
        void EnterWorld()
        {
            _instance.Enter(ConfigurationManager.AppSettings["world"]);
            var position = ConfigurationManager.AppSettings["position"].Split(',');
            var rotation = ConfigurationManager.AppSettings["rotation"].Split(',');
            var ci       = new CultureInfo("en-US");

            _instance.UpdateAvatar(float.Parse(position[0], ci), float.Parse(position[1], ci),
                                   float.Parse(position[2], ci),
                                   float.Parse(rotation[0], ci), float.Parse(rotation[1]));
            _timer = new Timer(AliveCallBack, null, 0, 0);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: locodarwin/Pharaoh
        private void m_LoginDoWork(object sender, DoWorkEventArgs e)
        {
            // Check universe login state and abort if we're already logged in
            if (Globals.iInUniv == true)
            {
                m_Login.ReportProgress(0, "Already logged into universe!");
                return;
            }

            // Initalize the AW API?
            m_Login.ReportProgress(0, "Initializing the API instance.");
            _instance = new Instance();

            // Install events & callbacks
            m_Login.ReportProgress(0, "Installing events and callbacks.");
            //_instance.EventAvatarAdd += OnEventAvatarAdd;
            _instance.EventChat += OnEventChat;

            // Set universe login parameters
            _instance.Attributes.LoginName              = Globals.sBotName;
            _instance.Attributes.LoginOwner             = Globals.iCitNum;
            _instance.Attributes.LoginPrivilegePassword = Globals.sPassword;
            //_instance.Attributes.LoginApplication = Globals.sBotDesc;

            // Log into universe
            //m_Login.ReportProgress(0, "Entering universe.");
            var rc = _instance.Login();

            if (rc != Result.Success)
            {
                m_Login.ReportProgress(0, "Unable to log in to universe (reason:" + rc + ").");
                return;
            }
            else
            {
                m_Login.ReportProgress(0, "Universe entry successful.");
                Globals.iInUniv = true;
            }

            // Enter world

            // Prepare for Caretaker mode if the option has been enabled
            if (Globals.iCaretaker == true)
            {
                _instance.Attributes.EnterGlobal = true;
                m_Login.ReportProgress(0, "Caretaker mode requested.");
            }

            //m_Login.ReportProgress(0, "Logging into world " + Globals.sWorld + ".");
            rc = _instance.Enter(Globals.sWorld);
            if (rc != Result.Success)
            {
                m_Login.ReportProgress(0, "Failed to log into world" + Globals.sWorld + " (reason:" + rc + ").");
                _instance.Dispose();
                Globals.iInUniv = false;
                return;
            }
            else
            {
                m_Login.ReportProgress(0, "Entered world " + Globals.sWorld + ".");
                Globals.iInWorld = true;
            }

            // Test caretaker mode (if requested)
            if (Globals.iCaretaker == true)
            {
                if (_instance.Attributes.WorldCaretakerCapability == true)
                {
                    m_Login.ReportProgress(0, "Caretaker mode confirmed.");
                }
                else
                {
                    m_Login.ReportProgress(0, "Caretaker mode denied.");
                }
            }

            // Commit the positioning and become visible
            m_Login.ReportProgress(0, "Changing position in world.");
            _instance.Attributes.MyX    = Globals.iXPos;
            _instance.Attributes.MyY    = Globals.iYPos;
            _instance.Attributes.MyZ    = Globals.iZPos;
            _instance.Attributes.MyYaw  = Globals.iYaw;
            _instance.Attributes.MyType = Globals.iAV;
            Globals.Dest.x   = Globals.iXPos;
            Globals.Dest.y   = Globals.iYPos;
            Globals.Dest.z   = Globals.iZPos;
            Globals.Dest.yaw = Globals.iYaw;

            rc = _instance.StateChange();
            if (rc == Result.Success)
            {
                m_Login.ReportProgress(0, "Movement successful.");
            }
            else
            {
                m_Login.ReportProgress(0, "Movement aborted (reason: " + rc + ").");
            }
        }
コード例 #4
0
        private void butLoginWorld_Click(object sender, EventArgs e)
        {
            // Check universe login state and abort if we're not already logged in
            if (Globals.iInUniv == false)
            {
                Stat(1, "Error", "Not logged into universe! Aborting.", "red");
                return;
            }

            // Check world login state and abort if we're already logged in
            if (Globals.iInWorld == true)
            {
                Stat(1, "Error", "Already logged into world! Aborting.", "red");
                return;
            }

            // Disable world login button (and logout button, temporarily)
            butLoginWorld.Enabled = false;
            butLogOut.Enabled     = false;

            // Prepare caretakermode
            m_bot.Attributes.EnterGlobal = true;

            // Enter world
            Stat(1, "World Login", "Logging into world " + Globals.sWorld + ".", "black");
            var rc = m_bot.Enter(Globals.sWorld);

            if (rc != Result.Success)
            {
                Stat(1, "Error", "Failed to log into world " + Globals.sWorld + " (reason:" + rc + ").", "red");
                butLogOut.Enabled = true;
                return;
            }
            else
            {
                Stat(1, "World Login", "World entry successful.", "black");
                Globals.iInWorld = true;
            }

            // Commit the positioning and become visible
            Stat(1, "World Pos", "Changing position in world.", "black");
            m_bot.Attributes.MyX    = Globals.iXPos;
            m_bot.Attributes.MyY    = Globals.iYPos;
            m_bot.Attributes.MyZ    = Globals.iZPos;
            m_bot.Attributes.MyYaw  = Globals.iYaw;
            m_bot.Attributes.MyType = Globals.iAV;

            rc = m_bot.StateChange();
            if (rc == Result.Success)
            {
                Stat(1, "World Pos", "Movement successful.", "black");
            }
            else
            {
                Stat(1, "World Pos", "Movement aborted (reason: " + rc + ").", "red");
            }

            // Enable all the appropriate buttons
            butLogOut.Enabled      = true;
            butMove2Coords.Enabled = true;
            butSimStart.Enabled    = true;
            butSendChat.Enabled    = true;
            butSimConfig.Enabled   = true;
        }
コード例 #5
0
ファイル: InstanceProxy.cs プロジェクト: mesh42/vpnet
 public void Enter(string worldname)
 {
     _pipeProxy.Enter(worldname);
 }