Пример #1
0
        public void UpdateParam(L2DModel model)
        {
            if (model != lastModel)
            {
                InitializeParam(model);
            }
            lastModel = model;

            foreach (List <L2DParts> partsList in Groups)
            {
                foreach (L2DParts parts in partsList)
                {
                    int partsIDX = parts.PartsIDX;
                    int paramIDX = parts.ParamIDX;
                    if (partsIDX < 0)
                    {
                        continue;
                    }

                    bool visible = (model.GetParamFloat(paramIDX) != 0);
                    model.SetPartsOpacity(partsIDX, (visible ? 1.0f : 0.0f));
                    model.SetParamFloat(paramIDX, (visible ? 1.0f : 0.0f));
                }
            }
        }
Пример #2
0
        private void InitializeParam(L2DModel model)
        {
            int offset = 0;

            for (int i = 0; i < Groups.Count(); i++)
            {
                for (int j = 0; j < Groups[i].Count(); j++)
                {
                    L2DParts parts = Groups[i][j];
                    parts.InitializeIDX(model);

                    int partsIDX = parts.PartsIDX;
                    int paramIDX = parts.ParamIDX;
                    if (partsIDX < 0)
                    {
                        continue;
                    }

                    model.SetPartsOpacity(partsIDX, j == offset ? 1.0f : 0.0f);
                    model.SetParamFloat(paramIDX, j == offset ? 1.0f : 0.0f);

                    foreach (L2DParts link in parts.Link)
                    {
                        link.InitializeIDX(model);
                    }
                }

                offset += i;
            }
        }
Пример #3
0
 /// <summary>
 /// For each <see cref="L2DModel.Motion"/> do <paramref name="action"/>
 /// </summary>
 /// <remarks>
 /// It will want to do anything for all or any motions.
 /// </remarks>
 /// <param name="model">The l2d model</param>
 /// <param name="action">The action</param>
 public static void DoMotion(this L2DModel model, Action <L2DMotion> action)
 {
     if (model.Motion != null)
     {
         foreach (var item in model.Motion)
         {
             foreach (var m in item.Value)
             {
                 action?.Invoke(m);
             }
         }
     }
 }
Пример #4
0
        /// <summary>
        /// The extension to easy create <see cref="MotionPlayer"/> with <paramref name="view"/>
        /// </summary>
        /// <param name="model">The l2d model</param>
        /// <param name="millsec">Fade millsecond</param>
        /// <exception cref="ArgumentNullException">When <paramref name="model"/>, <paramref name="view"/> or <paramref name="key"/> <see langword="null"/></exception>
        /// <exception cref="KeyNotFoundException">When given key <paramref name="key"/> not in <see cref="L2DModel.Motion"/></exception>
        public static MotionPlayer CreatePlayer(this L2DModel model, L2DView view, string key)
        {
            if (model is null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (view is null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            var val = model.Motion[key];

            return(new MotionPlayer(view, val));
        }
Пример #5
0
 /// <summary>
 /// Set the fade out with value <paramref name="millsec"/> to each <see cref="L2DModel.Motion"/>
 /// </summary>
 /// <param name="model">The l2d model</param>
 /// <param name="millsec">Fade millsecond</param>
 public static void SetFadeOut(this L2DModel model, int millsec)
 {
     model.DoMotion(x => x.SetFadeOut(millsec));
 }
Пример #6
0
 public void UpdateParam(L2DModel model)
 {
     HRESULT.Check(NativeMethods.PhysicsUpdate(new IntPtr(Handle), new IntPtr(model.Handle), L2DUtility.GetUserTimeMSec() - startTimeMSec));
 }
Пример #7
0
 public L2DRender(L2DModel model)
 {
     _Model = model;
 }