Пример #1
0
    /// <summary>
    /// 创建一个推送动画
    /// </summary>
    /// <param name="StartPoint"></param>
    public static void PushAnimation(PPlayer Player, string PushText, PPushType PushType)
    {
        const int   FrameNumber = 25;
        const float TotalTime   = 0.5f;
        float       Offset      = 100.0f;
        Vector3     Speed       = new Vector3(0.0f, Offset / FrameNumber, 0.0f);
        Text        NewPush     = null;
        Color       PushColor   = PushType.PushColor;

        AddAnimation("推送[" + PushText + "]", () => {
            PushColor.a  -= 0.8f / FrameNumber;
            NewPush.color = PushColor;
            NewPush.rectTransform.Translate(Speed);
        }, FrameNumber, TotalTime, () => {
            PUIManager.AddNewUIAction("删除推送[" + PushText + "]", () => {
                UnityEngine.Object.Destroy(NewPush.gameObject);
            });
        }, () => {
            NewPush = UnityEngine.Object.Instantiate(PUIManager.GetUI <PMapUI>().PushText);
            NewPush.transform.SetParent(PUIManager.GetUI <PMapUI>().UIBackgroundImage);
            NewPush.rectTransform.localScale *= PUIManager.GetUI <PMapUI>().PushText.rectTransform.lossyScale.y;
            NewPush.color = PushColor;
            NewPush.text  = PushText;
            NewPush.rectTransform.position = PPlayerScene.GetScreenPosition(Player);
            NewPush.gameObject.SetActive(true);
        });
    }
Пример #2
0
 public PMovePositionOrder() : base("move_position",
                                    null,
                                    (string[] args) => {
     int PlayerIndex      = int.Parse(args[1]);
     int DestinationIndex = int.Parse(args[2]);
     if (0 <= PlayerIndex && PlayerIndex < PNetworkManager.NetworkClient.GameStatus.PlayerNumber && 0 <= DestinationIndex && DestinationIndex < PNetworkManager.NetworkClient.GameStatus.Map.BlockList.Count)
     {
         PBlock DestinationBlock          = PNetworkManager.NetworkClient.GameStatus.Map.BlockList[DestinationIndex];
         PPlayer Player                   = PNetworkManager.NetworkClient.GameStatus.PlayerList[PlayerIndex];
         Player.Position                  = DestinationBlock;
         Vector3 DestinationSpacePosition = PPlayerScene.GetSpacePosition(Player);
         PUIManager.GetUI <PMapUI>().Scene.PlayerGroup.MovePlayer(PlayerIndex, DestinationSpacePosition);
     }
 }) {
 }