Ejemplo n.º 1
0
 public void FromActionRow(Actions.ActionRow actionRow)
 {
     if (!actionRow.IsIDNull())
     {
         ID = Convert.ToInt32(actionRow.ID);
     }
     if (!actionRow.IsAllyActionNull())
     {
         AllyAction = Convert.ToInt32(actionRow.AllyAction);
     }
     if (!actionRow.IsAxisActionNull())
     {
         AxisAction = Convert.ToInt32(actionRow.AxisAction);
     }
     if (!actionRow.IsRadiusNull())
     {
         Radius = Convert.ToInt32(actionRow.Radius);
     }
     if (!actionRow.IsGoalNull())
     {
         Goal = Convert.ToInt32(actionRow.Goal);
     }
     if (!actionRow.IsGroupNull())
     {
         Group = Convert.ToInt32(actionRow.Group);
     }
     if (!actionRow.IsClassNull())
     {
         Class = Convert.ToInt32(actionRow.Class);
     }
     if (!actionRow.IsCloseNodeNull())
     {
         CloseNode = Convert.ToInt32(actionRow.CloseNode);
     }
     if (!actionRow.IsLinksNull())
     {
         Links = actionRow.Links;
     }
     if (!actionRow.IsProneNull())
     {
         Prone = Convert.ToInt32(actionRow.Prone);
     }
     if (!actionRow.IsActiveNull())
     {
         Active = Convert.ToInt32(actionRow.Active);
     }
     if (!actionRow.IsEntityNull())
     {
         Entity = Convert.ToInt32(actionRow.Entity);
     }
 }
Ejemplo n.º 2
0
        public static void WriteActions(string fileName, Actions actions)
        {
            fileName = GetActionFile(fileName);
            StringBuilder buff     = new StringBuilder();
            StringBuilder execBuff = new StringBuilder();

            int startNode = 0;
            int endNode   = 99;
            int count     = 0;

            foreach (DataRow row in actions.Action.Rows)
            {
                Actions.ActionRow actionRow = (Actions.ActionRow)row;

                if (actionRow.ID == null)
                {
                    continue;
                }

                // action_axis
                if (!actionRow.IsAxisActionNull())
                {
                    buff.Append("action_axis " + actionRow.ID + " " + actionRow.AxisAction + ";");
                }
                else
                {
                    buff.Append("action_axis " + actionRow.ID + " -1;");
                }

                // action_allies
                if (!actionRow.IsAllyActionNull())
                {
                    buff.Append("action_allies " + actionRow.ID + " " + actionRow.AllyAction + ";");
                }
                else
                {
                    buff.Append("action_allies " + actionRow.ID + " -1;");
                }

                if (!actionRow.IsCloseNodeNull())
                {
                    buff.Append("action_closenode " + actionRow.ID + " " + actionRow.CloseNode + ";");
                }

                if (!actionRow.IsEntityNull())
                {
                    buff.Append("action_ent " + actionRow.ID + " " + actionRow.Entity + ";");
                }

                if (!actionRow.IsRadiusNull())
                {
                    buff.Append("action_radius " + actionRow.ID + " " + actionRow.Radius + ";");
                }

                if (!actionRow.IsGoalNull())
                {
                    buff.Append("action_goal " + actionRow.ID + " " + actionRow.Goal + ";");
                }

                if (!actionRow.IsGroupNull())
                {
                    buff.Append("action_group " + actionRow.ID + " " + actionRow.Group + ";");
                }

                if (!actionRow.IsActiveNull())
                {
                    buff.Append("action_active " + actionRow.ID + " " + actionRow.Active + ";");
                }

                if (!actionRow.IsClassNull())
                {
                    buff.Append("action_class " + actionRow.ID + " " + actionRow.Class + ";");
                }

                if (!actionRow.IsLinksNull())
                {
                    buff.Append("action_links " + actionRow.ID + " " + actionRow.Links + ";");
                }

                if (!actionRow.IsProneNull())
                {
                    buff.Append("action_prone " + actionRow.ID + " " + actionRow.Prone + ";");
                }
                buff.Append("\r\n");

                count++;

                if (count > endNode)
                {
                    string subConfigFileName = fileName.Substring(0, fileName.LastIndexOf(".")) + "_" + startNode + "_" + endNode + ".cfg";
                    WriteConfig(subConfigFileName, buff);
                    buff      = new StringBuilder();
                    startNode = endNode + 1;
                    endNode   = startNode + 99;
                    execBuff.Append("exec " + subConfigFileName + "\r\n");
                }
            }

            if (buff.Length > 0)
            {
                string subConfigFileName = fileName.Substring(0, fileName.LastIndexOf(".")) + "_" + startNode + "_" + (count - 1) + ".cfg";
                WriteConfig(subConfigFileName, buff);
                execBuff.Append("exec " + subConfigFileName + "\r\n");
            }

            WriteConfig(fileName, execBuff);
        }