Esempio n. 1
0
 public Component GetComponent(ComponentDO componentDO)
 {
     switch (componentDO.Subclass.ToUpper())
     {
         case "BASIC":
             return new GuiComponent("Basic", ComponentDOUtil.GetIsClickable(componentDO));
         default:
             throw new Exception("GUI subclass not recognized by GuiFactory: " + componentDO.Subclass);
     }
 }
 public Component GetComponent(ComponentDO componentDO)
 {
     switch (componentDO.Subclass.ToUpper())
     {
         case "BASIC":
             return new PhysicsComponent(componentDO.Subclass);
         default:
             throw new Exception("Physics subclass not recognized by PhysicsFactory: " + componentDO.Subclass);
     }
 }
 public Component GetComponent(ComponentDO componentDO)
 {
     switch (componentDO.Subclass.ToUpper())
     {
         case "BASIC":
             return new BasicPlayerInput(componentDO.Subclass);
         case "CLICKTOMOVE":
             return new ClickToMoveInput(componentDO.Subclass);
         default:
             throw new Exception("Input subclass not recognized by InputFactory: " + componentDO.Subclass);
     }
 }
 public Component GetComponent(ComponentDO componentDO)
 {
     switch (componentDO.Subclass.ToUpper())
     {
         case "BASIC":
             return new CollisionRectangle(componentDO.Subclass, ComponentDOUtil.GetCollisionPercent(componentDO));
         case "CIRCLE":
             return new CollisionCircle(componentDO.Subclass, ComponentDOUtil.GetCollisionRadius(componentDO));
         case "RECTANGLE":
             return new CollisionRectangle(componentDO.Subclass, ComponentDOUtil.GetCollisionPercent(componentDO));
         default:
             throw new Exception("Collision subclass not recognized by CollisionFactory: " + componentDO.Subclass);
     }
 }
 public Component GetComponent(ComponentDO componentDO)
 {
     switch (componentDO.Subclass.ToUpper())
     {
         case "BASIC":
             return new BasicMovement("MovementComp", ComponentDOUtil.GetDirectionVector(componentDO), ComponentDOUtil.GetSpeed(componentDO));
         case "CIRCLE":
             return new CircleMovement("MovementComp", ComponentDOUtil.GetDirectionVector(componentDO), ComponentDOUtil.GetSpeed(componentDO), int.Parse(componentDO.Properties["Radius"]), int.Parse(componentDO.Properties["TimeToRotate"]));
         case "FORWARDFACING":
             return new ForwardFacingMovement("MovementComp", ComponentDOUtil.GetDirectionVector(componentDO), ComponentDOUtil.GetSpeed(componentDO));
         default:
             throw new Exception("Movement subclass not recognized by MovementFactory: " + componentDO.Subclass);
     }
 }
 public Component GetComponent(ComponentDO componentDO)
 {
     switch (componentDO.Subclass.ToUpper())
     {
         case "BASIC":
             return new RenderingComponent(componentDO.Subclass, ComponentDOUtil.GetSprite(componentDO));
         case "MULTITEXTURE":
             return new MultiTextureRenderingComponent(componentDO.Subclass, ComponentDOUtil.GetSprite(componentDO));
         case "GUI":
             GuiRenderingComponent comp = new GuiRenderingComponent(componentDO.Subclass, ComponentDOUtil.GetSprite(componentDO));
             comp.AddTexture(GuiTextureType.MOUSE_OVER, componentDO.Properties["MouseOverTextureName"]);
             comp.AddTexture(GuiTextureType.MOUSE_DOWN, componentDO.Properties["MouseDownTextureName"]);
             return comp;
         default:
             throw new Exception("Rendering subclass not recognized by RenderingFactory: " + componentDO.Subclass);
     }
 }
Esempio n. 7
0
        //private static void ClearFieldData(DAL database)
        //{
        //    database.Execute(CSM.Utility.SQL.CLEAR_FIELD_DATA);
        //}

        //inserts Component Records into master
        private static List <ComponentDO> BuildMasterComponentTable(DAL masterDAL, int numComp)
        {
            var masterFileName = System.IO.Path.GetFileName(masterDAL.Path);
            var compList       = new List <ComponentDO>();

            for (int i = 1; i <= numComp; i++)
            {
                String compFileName = GetCompFileName(masterFileName, i);
                var    compInfo     = masterDAL.From <ComponentDO>()
                                      .Where("FileName = @p1").Read(compFileName).FirstOrDefault();
                if (compInfo == null)
                {
                    compInfo          = new ComponentDO(masterDAL);
                    compInfo.GUID     = Guid.NewGuid();
                    compInfo.FileName = compFileName;
                    compInfo.Save();
                }

                compList.Add(compInfo);
            }
            return(compList);
        }
Esempio n. 8
0
        public static void CreateComponent(DAL masterDAL, int compNum, ComponentDO compInfo, String compPath)
        {
            //copy master to create component file
            masterDAL.CopyTo(compPath);
            var compDB = new DAL(compPath);

            try
            {
                compDB.BeginTransaction();
                compDB.Execute("DELETE FROM CountTree WHERE Component_CN IS NOT NULL;");
                compDB.Execute(SQL.CLEAR_FIELD_DATA);
                string command = string.Format("UPDATE CountTree Set Component_CN = {0};", compInfo.Component_CN);
                compDB.Execute(command);

                SetRowIDs(compNum, compDB);

                compDB.Execute("DELETE FROM Globals WHERE Block = 'Comp' AND Key = 'ChildComponents';");
                compDB.Execute("DELETE FROM Globals WHERE Block = 'Comp' AND Key = 'LastMerge';");

                compDB.CommitTransaction();
            }
            catch (Exception)
            {
                compDB.RollbackTransaction();
                try
                {
                    //component is probably jacked up, so delete it
                    System.IO.File.Delete(compDB.Path);
                }
                catch { } //may throw exception if file doesn't exist, but we can ignore that
            }
            finally
            {
                compDB.Dispose();
            }
        }