Пример #1
0
 partial void pRemoveAniJob(ScriptAniJob aniJob)
 {
     if (aniNames.Remove(aniJob.CodeName))
     {
         if (catalog != null)
         {
             catalog.RemoveJob(aniJob);
         }
     }
 }
Пример #2
0
 public bool TryGetAniFromJob(ScriptAniJob aniJob, out ScriptAni ani)
 {
     if (this.BaseInst.TryGetAniFromJob(aniJob.BaseAniJob, out Animation baseAni))
     {
         ani = (ScriptAni)baseAni.ScriptObject;
         return(true);
     }
     ani = null;
     return(false);
 }
Пример #3
0
        public bool TryGetAniJob(string codeName, out ScriptAniJob job)
        {
            if (codeName == null)
            {
                job = null;
                return(false);
            }

            return(aniNames.TryGetValue(codeName, out job));
        }
Пример #4
0
        partial void pAddAniJob(ScriptAniJob aniJob)
        {
            if (string.IsNullOrWhiteSpace(aniJob.CodeName))
            {
                throw new ArgumentException("CodeName of ScriptAniJob is null or white space!");
            }

            aniNames.Add(aniJob.CodeName, aniJob);

            if (catalog != null)
            {
                catalog.AddJob(aniJob);
            }
        }
Пример #5
0
 public void RemoveAniJob(ScriptAniJob aniJob)
 {
     this.baseDef.RemoveAniJob(aniJob.BaseAniJob);
     pRemoveAniJob(aniJob);
 }
Пример #6
0
 partial void pRemoveAniJob(ScriptAniJob aniJob);
Пример #7
0
 public void AddAniJob(ScriptAniJob aniJob)
 {
     this.baseDef.AddAniJob(aniJob.BaseAniJob);
     pAddAniJob(aniJob);
 }
Пример #8
0
 partial void pAddAniJob(ScriptAniJob aniJob);
Пример #9
0
 public void StartAniJobUncontrolled(ScriptAniJob aniJob)
 {
     this.BaseInst.StartUncontrolledAni(aniJob.BaseAniJob);
 }
Пример #10
0
 public bool IsAniActive(ScriptAniJob job)
 {
     return(this.BaseInst.GetActiveAniFromAniJob(job.BaseAniJob) != null);
 }
Пример #11
0
 public ActiveAni StartAniJob(ScriptAniJob aniJob, float fpsMult = 1, float progress = 0, params FrameActionPair[] pairs)
 {
     return(this.BaseInst.StartAniJob(aniJob.BaseAniJob, fpsMult, progress, pairs));
 }
Пример #12
0
 public ActiveAni StartAniJob(ScriptAniJob aniJob, params FrameActionPair[] pairs)
 {
     return(StartAniJob(aniJob, 1, 0, pairs));
 }
Пример #13
0
 public ActiveAni StartAniJob(ScriptAniJob aniJob, Action onEnd)
 {
     return(StartAniJob(aniJob, 1, 0, FrameActionPair.OnEnd(onEnd)));
 }
Пример #14
0
        /// <summary>
        /// Create ScriptAniJob-objects from diverse input and output them as Dictionary aniJobByID.
        /// </summary>
        /// <param name="dataTable"></param>
        /// <param name="aniByID"></param>
        /// <param name="overlayByID"></param>
        /// <param name="overlayAniJobRelations"></param>
        /// <param name="aniJobByID"></param>
        /// <returns></returns>
        public bool TryGenerateScriptAniJobs(List <List <object> > dataTable,
                                             Dictionary <int, ScriptAni> aniByID, Dictionary <int, ScriptOverlay> overlayByID,
                                             List <ScriptOverlayAniJobRelation> overlayAniJobRelations,
                                             out Dictionary <int, int> nextIDByAniJobID,
                                             out Dictionary <int, ScriptAniJob> aniJobByID)
        {
            nextIDByAniJobID = new Dictionary <int, int>();
            aniJobByID       = new Dictionary <int, ScriptAniJob>(dataTable.Count);

            List <ColumnGetTypeInfo> info;

            TryGetColGetTypeInfo("ScriptAniJob", out info);

            try
            {
                foreach (List <object> row in dataTable)
                {
                    var aniJob       = new ScriptAniJob();
                    var currID       = -1;
                    var nextID       = -1;
                    var defaultAniID = -1;
                    for (int c = 0; c < row.Count; c++)
                    {
                        switch (info[c].colName)
                        {
                        case "ScriptAniJobID":
                            currID = (int)row[c];
                            break;

                        case "DefaultAniID":
                            if (row[c] is null)
                            {
                                break;
                            }
                            defaultAniID = (int)row[c];
                            break;

                        case "AniName":
                            aniJob.AniName = (string)row[c];
                            break;

                        case "CodeName":
                            aniJob.CodeName = (string)row[c];
                            break;

                        case "NextScriptAniJobID":
                            if (row[c] is null)
                            {
                                break;
                            }
                            nextID = (int)row[c];
                            break;

                        case "Layer":
                            if (row[c] is null)
                            {
                                break;
                            }
                            aniJob.Layer = (int)row[c];
                            break;
                        }
                    }

                    if (currID <= -1)
                    {
                        throw new Exception("Didn't find ScriptAniJobID in db-data!");
                    }
                    if (defaultAniID > -1)
                    {
                        aniJob.SetDefaultAni(aniByID[defaultAniID]);
                    }

                    // prepare for later completion of the initialization after all ScriptAniJobs-objects are present
                    aniJobByID.Add(currID, aniJob);

                    if (nextID > -1)
                    {
                        nextIDByAniJobID.Add(currID, nextID);
                    }
                }

                foreach (var kv in nextIDByAniJobID)
                {
                    aniJobByID[kv.Key].NextAni = aniJobByID[kv.Value];
                }

                foreach (var r in overlayAniJobRelations)
                {
                    var ani     = aniByID[r.ScriptAniID];
                    var aniJob  = aniJobByID[r.ScriptAniJobID];
                    var overlay = overlayByID[r.ScriptOverlayID];
                    aniJob.AddOverlayAni(ani, overlay);
                }
            }
            catch (Exception ex)
            {
                info = null;
                MakeLogError(ex);
                return(false);
            }

            return(true);
        }