Beispiel #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);
        });
    }
Beispiel #2
0
 public PPushTextOrder() : base("push_text",
                                null,
                                (string[] args) => {
     PPlayer Player     = PNetworkManager.NetworkClient.GameStatus.FindPlayer(Convert.ToInt32(args[1]));
     string TextToPush  = args[2];
     PPushType PushType = FindInstance <PPushType>(args[3]);
     if (Player != null && PushType != null)
     {
         PAnimation.PushAnimation(Player, TextToPush, PushType);
     }
 }) {
 }