示例#1
0
      /// <summary>
      /// Overload which lets the caller specify the default positioning of the
      /// window if the saved position could not be restored.
      /// </summary>
      public static Status RestoreWindowPosition(Window window, Window parent, DefaultPosition position)
      {
         if (window == null)
            return Status.NoResult;

         // If this window has a saved position, use that.
         ISenescoWindow senescoWindow = window as ISenescoWindow;
         if (senescoWindow != null && RestoreWindowPosition(senescoWindow) == Status.Success)
            return Status.Success;

         // Otherwise move the window to the specified default.
         switch (position)
         {
            case DefaultPosition.GlobalDefault:
               PositionGlobalDefault(window);
               return Status.Success;
            case DefaultPosition.CenterOnParent:
               CenterChildOnParent(parent, window);
               return Status.Success;
            case DefaultPosition.RightOfParent:
               ChildRightSideOfParent(parent, window);
               return Status.Success;
         }
         return Status.NoResult;
      }
示例#2
0
 public Person(string surname, string firstname, DefaultPosition dP, Role role)
 {
     this.surname = surname;
     this.firstname = firstname;
     name = firstname + " " + surname;
     this.defaultPosition = dP;
     this.role = role;
 }
示例#3
0
        public static async Task PostLoad(this AtlasCharacter character)
        {
            AtlasPlugin.Instance.AttachTickHandler(Intro);

            Session.CreatingCharacter = true;

            var player    = Cache.Player;
            var timestamp = API.GetGameTimer();

            while (timestamp + 5000 > API.GetGameTimer())
            {
                await BaseScript.Delay(100);
            }

            Session.Reload();

            AtlasPlugin.Instance.DetachTickHandler(Intro);

            var board = new MugshotBoardAttachment();

            player.DisableHud();

#pragma warning disable 4014
            board.Attach(player);

            player.CameraQueue.View(new CameraBuilder()
                                    .WithMotionBlur(0.5f)
                                    .WithInterpolation(CameraViews[0], CameraViews[1], 5000)
                                    );
#pragma warning restore 4014

            API.DoScreenFadeIn(5000);

            await player.AnimationQueue.PlayDirectInQueue(new AnimationBuilder()
                                                          .Select("mp_character_creation@customise@male_a", "intro")
                                                          );

            player.AnimationQueue.AddToQueue(new AnimationBuilder()
                                             .Select("mp_character_creation@customise@male_a", "loop")
                                             .WithFlags(AnimationFlags.Loop)
                                             .SkipTask()
                                             ).PlayQueue();

            var registered = false;
            var view       = 0;

            StyleManager.GetModule().OpenStyleChange(character.Style, "General", 0, async type =>
            {
                if (type == 0)
                {
                    registered = true;
                }
                else
                {
                    var item = InterfaceManager.GetModule().MenuContext.Selected;

                    if (item == null)
                    {
                        return;
                    }

                    var head = HeadComponents.Select(self => self.ToLower())
                               .Contains(item.Seed.Replace("style_component_", "").ToLower());

                    if (head && view == 0)
                    {
                        view = 1;

                        player.CameraQueue.Reset();

                        await player.CameraQueue.View(new CameraBuilder()
                                                      .SkipTask()
                                                      .WithMotionBlur(0.5f)
                                                      .WithInterpolation(CameraViews[1], CameraViews[2], 300)
                                                      );
                    }
                    else if (!head && view == 1)
                    {
                        view = 0;

                        player.CameraQueue.Reset();

                        await player.CameraQueue.View(new CameraBuilder()
                                                      .SkipTask()
                                                      .WithMotionBlur(0.5f)
                                                      .WithInterpolation(CameraViews[2], CameraViews[1], 300)
                                                      );
                    }
                }
            }, "CHAR_CREATE", "All");

            while (!registered)
            {
                if (!API.IsEntityPlayingAnim(player.Entity.Id, "mp_character_creation@customise@male_a", "loop", 3))
                {
                    player.AnimationQueue.AddToQueue(new AnimationBuilder()
                                                     .Select("mp_character_creation@customise@male_a", "loop")
                                                     .WithFlags(AnimationFlags.Loop)
                                                     .SkipTask()
                                                     ).PlayQueue();

                    board.IsAttached = false;

#pragma warning disable 4014
                    board.Attach(player);
#pragma warning restore 4014
                }

                await BaseScript.Delay(100);
            }

            player.AnimationQueue.AddToQueue(new AnimationBuilder()
                                             .Select("mp_character_creation@customise@male_a", "outro")
                                             .WithFlags(AnimationFlags.StayInEndFrame)
                                             ).PlayQueue();

            API.DoScreenFadeOut(3000);

            await BaseScript.Delay(5500);

            Session.Join(1);

            board.IsAttached = false;

            await SafeTeleport.Teleport(player.Entity.Id, new Position(-1045.326f, -2750.793f, 21.36343f, 330.1637f));

#pragma warning disable 4014
            player.CameraQueue.View(new CameraBuilder()
#pragma warning restore 4014
                                    .WithMotionBlur(0.5f)
                                    .WithInterpolation(
                                        new RotatablePosition(-1032.415f, -2726.847f, 26.48441f, 152.7852f, -7f, 0f),
                                        new RotatablePosition(-1032.415f, -2726.847f, 22.23441f, 152.7852f, -7f, 0f),
                                        10000)
                                    );

            API.DoScreenFadeIn(8000);

            API.TaskGoStraightToCoord(player.Entity.Id, DefaultPosition.X, DefaultPosition.Y, DefaultPosition.Z,
                                      1f,
                                      -1,
                                      DefaultPosition.Heading, 0f);

            while (DefaultPosition.Distance(player.Entity.Position) > 0.1 ||
                   Math.Abs(DefaultPosition.Heading - player.Entity.Position.Heading) > 1)
            {
                await BaseScript.Delay(10);
            }

            character.MarkedAsRegistered = true;

            await character.Save();

            await player.AnimationQueue.PlayDirectInQueue(new AnimationBuilder()
                                                          .Select("move_p_m_one_idles@generic", "fidget_look_around")
                                                          );

            API.TransitionToBlurred(0f);

            player.EnableHud();
            player.CameraQueue.Reset();

            await BaseScript.Delay(10);

            API.TransitionFromBlurred(500f);

            await BaseScript.Delay(1000);

            Session.CreatingCharacter = false;
        }
示例#4
0
 private static void Update(float state, DefaultSpeed speed, ref DefaultPosition position)
 {
     position.X += speed.X * state;
     position.Y += speed.Y * state;
 }