コード例 #1
0
        private void AddTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRTileconfig vtc = new VRTileconfig()
                {
                    TileGUID        = tileConfig.TileGUID,
                    TileTitle       = tileConfig.TileTitle,
                    TileHeight      = tileConfig.TileHeight,
                    TileWidth       = tileConfig.TileWidth,
                    TileDesc        = tileConfig.TileDesc,
                    Command         = tileConfig.Command,
                    Arguments       = tileConfig.Arguments,
                    WorkingPath     = tileConfig.WorkingPath,
                    Order           = tileConfig.Order,
                    TileRowNumber   = tileConfig.TileRowNumber,
                    TileConfigSetID = tileConfig.TileConfigSetID,
                    VRTileconfigID  = tileConfig.TileconfigID,
                    ImageData       = tileConfig.TileImage.ImageData,
                    AgeRequire      = tileConfig.AgeRequire,
                    VideoURL        = tileConfig.VideoURL,
                    IsDeleted       = false
                };

                m.Add(vtc);
                m.SaveChanges();
                //m.Cache.Release(m.VRTileconfigs);
            }

            GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID);
        }
コード例 #2
0
        private void ModifyTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRTileconfig vtc = m.VRTileconfigs.Where(x => x.ID == tileConfig.ID).FirstOrDefault();

                if (vtc != null)
                {
                    vtc.TileGUID       = tileConfig.TileGUID;
                    vtc.TileTitle      = tileConfig.TileTitle;
                    vtc.TileHeight     = tileConfig.TileHeight;
                    vtc.TileWidth      = tileConfig.TileWidth;
                    vtc.TileDesc       = tileConfig.TileDesc;
                    vtc.Command        = tileConfig.Command;
                    vtc.Arguments      = tileConfig.Arguments;
                    vtc.WorkingPath    = tileConfig.WorkingPath;
                    vtc.Order          = tileConfig.Order;
                    vtc.TileRowNumber  = tileConfig.TileRowNumber;
                    vtc.VRTileconfigID = tileConfig.TileconfigID;
                    vtc.ImageData      = tileConfig.TileImage.ImageData;
                    vtc.AgeRequire     = tileConfig.AgeRequire;
                    vtc.VideoURL       = tileConfig.VideoURL;

                    m.SaveChanges();
                    //m.Cache.Release(m.VRTileconfigs);
                }
            }

            GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID);
        }
コード例 #3
0
        private void DeleteTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRTileconfig vtc = m.VRTileconfigs.Where(x => x.ID == tileConfig.ID).FirstOrDefault();

                if (vtc != null)
                {
                    vtc.IsDeleted = true;
                    m.SaveChanges();
                    //m.Cache.Release(m.VRTileconfigs);
                }
            }

            GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID);
        }
コード例 #4
0
        private void ReorderTileConfig(bool isMovingUp, VRGameSelectorServerDTO.TileConfig tileConfig)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRTileconfig currentVrtc = m.VRTileconfigs.Where(x => x.ID == tileConfig.ID && !x.IsDeleted).ToList().FirstOrDefault();

                List <VRTileconfig> rootLevelVrtcs;
                List <VRTileconfig> sortedRootLevelVrtcs;
                VRTileconfig        targetRootLevelVrtc;

                List <VRTileconfig> sortedSubVrtcs;
                VRTileconfig        targetSubVrtc;

                if (currentVrtc != null)
                {
                    if (tileConfig.TileconfigID == 0)
                    {
                        // root level tile

                        rootLevelVrtcs       = m.VRTileconfigs.Where(x => x.VRTileconfigID == 0 && x.TileConfigSetID == tileConfig.TileConfigSetID && !x.IsDeleted).ToList();
                        sortedRootLevelVrtcs = rootLevelVrtcs.OrderBy(x => x.Order).ToList();

                        if (sortedRootLevelVrtcs.Count > 1)
                        {
                            int posCurrentVrtc = sortedRootLevelVrtcs.IndexOf(currentVrtc);

                            if (posCurrentVrtc > 0 && isMovingUp)
                            {
                                targetRootLevelVrtc = sortedRootLevelVrtcs[posCurrentVrtc - 1];
                                targetRootLevelVrtc.Order++;
                                currentVrtc.Order--;
                            }
                            else if (posCurrentVrtc < sortedRootLevelVrtcs.Count - 1 && !isMovingUp)
                            {
                                targetRootLevelVrtc = sortedRootLevelVrtcs[posCurrentVrtc + 1];
                                targetRootLevelVrtc.Order--;
                                currentVrtc.Order++;
                            }
                        }
                    }
                    else
                    {
                        // sub level tile

                        VRTileconfig parentVrtc = m.VRTileconfigs.Where(x => x.ID == tileConfig.TileconfigID && !x.IsDeleted).ToList().FirstOrDefault();

                        if (parentVrtc != null && parentVrtc.VRTileconfigs.Count > 1)
                        {
                            sortedSubVrtcs = parentVrtc.VRTileconfigs.OrderBy(x => x.Order).ToList();

                            if (sortedSubVrtcs.Count > 1)
                            {
                                int posCurrentVrtc = sortedSubVrtcs.IndexOf(currentVrtc);

                                if (posCurrentVrtc > 0 && isMovingUp)
                                {
                                    targetSubVrtc = sortedSubVrtcs[posCurrentVrtc - 1];
                                    targetSubVrtc.Order++;
                                    currentVrtc.Order--;
                                }
                                else if (posCurrentVrtc < sortedSubVrtcs.Count - 1 && !isMovingUp)
                                {
                                    targetSubVrtc = sortedSubVrtcs[posCurrentVrtc + 1];
                                    targetSubVrtc.Order--;
                                    currentVrtc.Order++;
                                }
                            }
                        }
                    }

                    m.SaveChanges();
                    //m.Cache.Release(m.VRTileconfigs);
                }
            }
        }
コード例 #5
0
        private void ReorderDownTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig)
        {
            ReorderTileConfig(false, tileConfig);

            GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID);
        }
コード例 #6
0
 public VRCommandServer(Enums.ControlMessage controlMessage, TileConfig tileConfig)
 {
     ControlMessage = controlMessage;
     TileConfig     = tileConfig;
 }