コード例 #1
0
        public AptContext(AptWindow window)
        {
            Window      = window;
            _assetStore = window.AssetStore;

            Avm = new VM();
        }
コード例 #2
0
        public AssetSummaryViewModel(AssetStore assetStore)
        {
            this.assetStore       = assetStore;
            AssetListingViewModel = new AssetListingViewModel(assetStore, a => a.Take(3));

            assetStore.StateChanged += AssetStore_StateChanged;
        }
コード例 #3
0
 //constructor to be used without an apt file
 internal AptContext(ImageMap imageMap, string movieName, AssetStore assetStore)
 {
     _assetStore = assetStore;
     _imageMap   = imageMap;
     _movieName  = movieName;
     Avm         = new VM();
 }
コード例 #4
0
        public void SerializeAndDeserialize_WhenSpriteIsNotNull()
        {
            // Arrange
            var texture       = Substitute.For <ITexture>();
            var sprite        = new Sprite(texture, Vector2.Zero, Vector2.Zero, Vector2.Zero, 0);
            var spriteAssetId = AssetId.CreateUnique();

            var component = new SpriteRendererComponent
            {
                Visible          = false,
                SortingLayerName = "Some sorting layer",
                OrderInLayer     = 2,
                Sprite           = sprite
            };

            AssetStore.GetAssetId(sprite).Returns(spriteAssetId);
            AssetStore.GetAsset <Sprite>(spriteAssetId).Returns(sprite);

            // Act
            var actual = SerializeAndDeserialize(component);

            // Assert
            Assert.That(actual.Visible, Is.EqualTo(component.Visible));
            Assert.That(actual.SortingLayerName, Is.EqualTo(component.SortingLayerName));
            Assert.That(actual.OrderInLayer, Is.EqualTo(component.OrderInLayer));
            Assert.That(actual.Sprite, Is.EqualTo(sprite));
        }
コード例 #5
0
        public RadiusCursorDecals(AssetStore assetStore, GraphicsDevice graphicsDevice)
        {
            _assetStore     = assetStore;
            _graphicsDevice = graphicsDevice;

            _decalConstantBuffer = AddDisposable(new ConstantBuffer <RadiusCursorDecalShaderResources.RadiusCursorDecalConstants>(
                                                     graphicsDevice,
                                                     "RadiusCursorDecalConstants"));

            DecalConstants = _decalConstantBuffer.Buffer;

            DecalsBuffer = AddDisposable(graphicsDevice.ResourceFactory.CreateBuffer(
                                             new BufferDescription(
                                                 RadiusCursorDecal.SizeInBytes * MaxDecals,
                                                 BufferUsage.StructuredBufferReadOnly | BufferUsage.Dynamic,
                                                 RadiusCursorDecal.SizeInBytes,
                                                 true)));

            _decalsStorage = new List <DecalHandle>();

            _decals = new RadiusCursorDecal[MaxDecals];

            _nameToTextureIndex = new Dictionary <Texture, uint>();

            TextureArray = AddDisposable(graphicsDevice.ResourceFactory.CreateTexture(
                                             TextureDescription.Texture2D(
                                                 TextureSize,
                                                 TextureSize,
                                                 TextureMipLevels,
                                                 MaxTextures,
                                                 PixelFormat.BC3_UNorm, // TODO: Allow other types
                                                 TextureUsage.Sampled)));
        }
コード例 #6
0
        public IniParser(FileSystemEntry entry, AssetStore assetStore, SageGame sageGame, IniDataContext dataContext, Encoding localeSpecificEncoding)
        {
            var iniEncoding = Encoding.ASCII;

            {
                // Use locale specific encoding if a "9x ini file" is present:
                // https://github.com/OpenSAGE/OpenSAGE/issues/405
                var localeSpecificFileName = Path.ChangeExtension(entry.FilePath, null) + "9x.ini";
                var localeSpecificEntry    = entry.FileSystem.GetFile(localeSpecificFileName);
                if (localeSpecificEntry != null)
                {
                    entry       = localeSpecificEntry;
                    iniEncoding = localeSpecificEncoding;
                }
            }

            _directory   = Path.GetDirectoryName(entry.FilePath);
            _dataContext = dataContext;
            _fileSystem  = entry.FileSystem;
            _assetStore  = assetStore;
            SageGame     = sageGame;
            _encoding    = iniEncoding;

            _tokenReader = CreateTokenReader(entry, _encoding);

            _currentBlockOrFieldStack = new Stack <string>();
        }
コード例 #7
0
        public void SerializeAndDeserialize_WhenInputMappingIsNotNull()
        {
            // Arrange
            var inputMapping        = new InputMapping();
            var inputMappingAssetId = AssetId.CreateUnique();

            var component = new InputComponent
            {
                InputMapping = inputMapping
            };

            AssetStore.GetAssetId(inputMapping).Returns(inputMappingAssetId);
            AssetStore.GetAsset <InputMapping>(inputMappingAssetId).Returns(inputMapping);

            // Act
            var actual = SerializeAndDeserialize(component);

            // Assert
            Assert.That(actual.InputMapping, Is.EqualTo(inputMapping));
            Assert.That(actual.HardwareInput, Is.EqualTo(HardwareInput.Empty));
            Assert.That(actual.ActionBindings, Is.Empty);
            Assert.That(actual.AxisBindings, Is.Empty);
            Assert.That(actual.ActionStates, Is.Empty);
            Assert.That(actual.AxisStates, Is.Empty);
        }
コード例 #8
0
 void DrawTutorial()
 {
     if (subStep == 0)
     {
         DrawText("MFPS come with support for Photon Voice, for use as Team Chat Voice feature.\n\n In order to use it you need do a few simply steps.");
         DrawImage(GetServerImage(0), TextAlignment.Center);
         DownArrow();
         DrawText("First all, you need to import the Photon Voice 2 package, you can get it free from the Asset Store, click in the button bellow to redirect to the package page:");
         GUILayout.Space(5);
         if (DrawButton("<color=yellow>Open Photon Voice 2</color>"))
         {
             AssetStore.Open("content/130518");
             NextStep();
         }
     }
     else if (subStep == 1)
     {
         DrawText("Now download and import the package from the asset store page and wait until process finish.");
         DownArrow();
         DrawText("Then, you need enable the integrated code, for it Go to (Toolbar) MFPS -> Addons -> Voice -> <b>Enable</b> and wait until script compilation finish.");
         DrawImage(GetServerImage(1));
         DownArrow();
         DrawText("After compilation finish do the same but click on the 'Integrate' button MFPS -> Addons -> Voice -> <b>Integrate</b>");
         DownArrow();
         DrawText("Ok, it's all, now Photon Voice is integrated");
     }
     else if (subStep == 2)
     {
         DrawText("For default Voice is set up to transmit only when push a key (Push to Talk) and is recommended use that way, you can change the key in bl_PlayerVoice.cs" +
                  " which is attached in the root of each Player prefab in Resources folder");
         DrawImage(GetServerImage(2));
     }
 }
コード例 #9
0
        public static void Load(string path, AssetStore <string> assets)
        {
            foreach (PropertyBag artProp in PropertyBag.FromFile(path))
            {
                string      sheetName = artProp.GetOrDefault("sheet", string.Empty);
                Spritesheet sheet     = assets.GetAsset <Spritesheet>(sheetName);

                string name   = artProp.Name;
                int    x      = artProp.GetOrDefault("x", 0);
                int    y      = artProp.GetOrDefault("y", 0);
                int    width  = artProp.GetOrDefault("width", -1);
                int    height = artProp.GetOrDefault("height", -1);
                bool   exact  = artProp.GetOrDefault("exact", false);

                Vector2?origin = DataLoader.ParseVector(artProp.GetOrDefault("origin", null));

                Sprite sprite;

                if (!exact)
                {
                    sprite = sheet.CutSprite(x, y, width, height, name, origin);
                }
                else
                {
                    sprite = sheet.CutSpriteExact(x, y, width, height, name, origin);
                }
                assets.AddAsset(name, sprite);
                Console.WriteLine($"Loaded Sprite: {name}");
            }
        }
コード例 #10
0
        public void SerializeAndDeserialize_WhenCurrentAnimationIsNull()
        {
            // Arrange
            var animation        = CreateAnimation();
            var animationAssetId = AssetId.CreateUnique();

            var component = new SpriteAnimationComponent();

            component.AddAnimation("animation", animation);
            component.Position      = 0.7;
            component.PlaybackSpeed = 1.3;
            component.PlayInLoop    = true;

            AssetStore.GetAssetId(animation).Returns(animationAssetId);
            AssetStore.GetAsset <SpriteAnimation>(animationAssetId).Returns(animation);

            // Act
            var actual = SerializeAndDeserialize(component);

            // Assert
            Assert.That(actual.Animations, Has.Count.EqualTo(1));
            Assert.That(actual.Animations.Single().Key, Is.EqualTo("animation"));
            Assert.That(actual.Animations.Single().Value, Is.EqualTo(animation));
            Assert.That(actual.CurrentAnimation, Is.Null);
            Assert.That(actual.IsPlaying, Is.False);
            Assert.That(actual.Position, Is.EqualTo(component.Position));
            Assert.That(actual.PlaybackSpeed, Is.EqualTo(component.PlaybackSpeed));
            Assert.That(actual.PlayInLoop, Is.EqualTo(component.PlayInLoop));
        }
コード例 #11
0
        internal static BridgeTowers CreateForLandmarkBridge(
            AssetStore assetStore,
            GameObjectCollection gameObjects,
            GameObject gameObject,
            MapObject mapObject)
        {
            var worldMatrix =
                Matrix4x4.CreateFromQuaternion(gameObject.Transform.Rotation)
                * Matrix4x4.CreateTranslation(gameObject.Transform.Translation);

            var landmarkBridgeTemplate = assetStore.BridgeTemplates.GetByName(mapObject.TypeName);

            var halfLength = gameObject.Definition.Geometry.MinorRadius;
            var halfWidth  = gameObject.Definition.Geometry.MajorRadius;

            return(new BridgeTowers(
                       landmarkBridgeTemplate,
                       gameObjects,
                       worldMatrix,
                       -halfWidth,
                       -halfLength,
                       halfWidth,
                       halfLength,
                       gameObject.Transform.Rotation));
        }
コード例 #12
0
        private void ShowIntegration(string name, string description, string link, string exampleLink, string defName, Action onEnable, Action onDisable)
        {
            GUILayout.BeginVertical("box");
            if (GUILayout.Toggle(IsIntegrationEnabled(defName), name))
            {
                EnableIntegration(defName, onEnable);
            }
            else
            {
                DisableIntegration(defName, onDisable);
            }
            GUILayout.Label(description, EditorStyles.wordWrappedLabel);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            Color color = GUI.contentColor;

            GUI.contentColor = new Color(0, 0, 0.7f, 0.9f);
            if (!string.IsNullOrEmpty(exampleLink) && GUILayout.Button("Example", "label"))
            {
                Application.OpenURL(exampleLink);
            }
            GUILayout.Space(3);
            if (!string.IsNullOrEmpty(link) && GUILayout.Button("Asset Store", "label"))
            {
                AssetStore.Open(link);
            }
            GUI.contentColor = color;
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
コード例 #13
0
        public WaterMapRenderer(
            AssetStore assetStore,
            GraphicsLoadContext graphicsLoadContext,
            GraphicsDevice graphicsDevice,
            GlobalShaderResources globalShaderResources)
        {
            _waterShaderResources = graphicsLoadContext.ShaderResources.Water;

            var _waterSets = assetStore.WaterSets;

            _waterTextureSet                 = new Dictionary <TimeOfDay, Texture>();
            _waterUvScrollSet                = new Dictionary <TimeOfDay, Vector2>();
            _waterDiffuseColorSet            = new Dictionary <TimeOfDay, ColorRgba>();
            _waterTransparentDiffuseColorSet = new Dictionary <TimeOfDay, ColorRgba>();

            foreach (var waterSet in _waterSets)
            {
                _waterTextureSet.Add(waterSet.TimeOfDay, waterSet.WaterTexture.Value.Texture);
                _waterUvScrollSet.Add(waterSet.TimeOfDay, new Vector2(waterSet.UScrollPerMS, waterSet.VScrollPerMS));
                _waterDiffuseColorSet.Add(waterSet.TimeOfDay, waterSet.DiffuseColor);
                _waterTransparentDiffuseColorSet.Add(waterSet.TimeOfDay, waterSet.TransparentDiffuseColor);
            }

            _bumpTexture = graphicsLoadContext.StandardGraphicsResources.SolidWhiteTexture;

            _waterConstantsPSBuffer = AddDisposable(new ConstantBuffer <GlobalShaderResources.WaterConstantsPS>(
                                                        graphicsDevice,
                                                        "WaterConstantsPS"));

            _uvOffset = Vector2.Zero;

            _transparentWaterDepth      = assetStore.WaterTransparency.Current.TransparentWaterDepth;
            _transparentWaterMinOpacity = assetStore.WaterTransparency.Current.TransparentWaterMinOpacity;
        }
コード例 #14
0
        public AssetSummaryViewModel(AssetStore assetStore)
        {
            _assetStore           = assetStore;
            AssetListingViewModel = new AssetListingViewModel(assetStore, assets => assets.Take(3));

            _assetStore.StateChanged += AssetStore_StateChanged;
        }
コード例 #15
0
        private int?UploadZipFolder(Tour existingTour, int?createUserId, HttpPostedFileBase krPanoZip)
        {
            int?assetId    = null;
            var clientId   = existingTour.ClientId;
            var locationId = _areaRepository.GetById(existingTour.AreaId)?.Id;
            var areaId     = existingTour.AreaId;
            var tourId     = existingTour.Id;

            if (locationId != null)
            {
                MemoryStream target = new MemoryStream();
                krPanoZip.InputStream.CopyTo(target);
                byte[] data        = target.ToArray();
                string path        = _fileService.UploadZip(data, clientId, tourId, areaId, locationId.Value);
                var    krPanoAsset = new AssetStore
                {
                    ClientId     = clientId,
                    Filename     = string.Format("KrPanoTour-{0}-{1}-{2}-{3}", clientId, locationId.Value, areaId, tourId),
                    FileType     = "html",
                    Nickname     = "krPano",
                    Path         = path,
                    CreateDate   = DateTime.Now,
                    CreateUserId = createUserId.Value
                };
                assetId = _assetStoreRepository.Create(krPanoAsset);
            }
            return(assetId);
        }
コード例 #16
0
 public static void OpenItemInAssetStore(AssetStoreAsset activeAsset)
 {
     if (activeAsset.id != 0)
     {
         AssetStore.Open(string.Format("content/{0}?assetID={1}", activeAsset.packageID, activeAsset.id));
     }
 }
コード例 #17
0
 internal static GameObject FromMapObject(
     MapObject mapObject,
     AssetStore assetStore,
     GameObjectCollection gameObjects,
     HeightMap heightMap,
     bool useRotationAnchorOffset = true,
     in float?overwriteAngle      = 0.0f,
コード例 #18
0
        void OnGUI()
        {
            GUIStyle guiStyle = new GUIStyle(GUI.skin.button)
            {
                richText = true
            };

            GUIStyle labelStyle = new GUIStyle(GUI.skin.label)
            {
                richText  = true,
                alignment = TextAnchor.MiddleCenter
            };

            GUI.DrawTexture(new Rect(10, 25, 70, 70), tex, ScaleMode.StretchToFill);

            GUI.Label(new Rect(85, 6, 150, 70), "<size=13><b>We improve plugins\n based on your\n reviews!</b></size>", labelStyle);

            if (GUI.Button(new Rect(110, 80, 100, 30), "<size=14><b>Rate</b></size>", guiStyle))
            {
                UpdatePlugins.SetAppRated(desc.Id);

                AssetStore.Open("content/" + desc.Id);

                Close();
            }
        }
コード例 #19
0
        internal Radar(Scene3D scene, AssetStore assetStore, MapCache mapCache)
        {
            _scene = scene;

            if (mapCache != null)
            {
                var mapPath  = FileSystem.NormalizeFilePath(mapCache.Name);
                var basePath = Path.GetDirectoryName(mapPath) + "/" + Path.GetFileNameWithoutExtension(mapPath);

                // Minimap images drawn by an artist
                var mapArtPath = basePath + "_art.tga";
                _miniMapTexture = assetStore.GuiTextures.GetByName(mapArtPath)?.Texture;

                if (_miniMapTexture == null)
                {
                    // Fallback to minimap images generated by WorldBuilder
                    mapArtPath      = basePath + ".tga";
                    _miniMapTexture = assetStore.GuiTextures.GetByName(mapArtPath)?.Texture;
                }
            }

            _visibleItems = new RadarItemCollection();
            _hiddenItems  = new RadarItemCollection();

            _radarEvents = new List <RadarEvent>();

            // TODO: Bridges
            // TODO: Fog of war / shroud
        }
コード例 #20
0
ファイル: CursorManager.cs プロジェクト: lanyizi/OpenSAGE
        public CursorManager(AssetStore assetStore, ContentManager contentManager, GameWindow window)
        {
            _cachedCursors = new Dictionary <string, Cursor>();

            _assetStore     = assetStore;
            _contentManager = contentManager;
            _window         = window;
        }
コード例 #21
0
 public SellViewModel(AssetStore assetStore, IStockPriceService stockPriceService, ISellStockService sellStockService, IAccountStore accountStore)
 {
     AssetListingViewModel  = new AssetListingViewModel(assetStore);
     SearchSymbolCommand    = new SearchSymbolCommand(this, stockPriceService);
     SellStockCommand       = new SellStockCommand(this, sellStockService, accountStore);
     ErrorMessageViewModel  = new MessageViewModel();
     StatusMessageViewModel = new MessageViewModel();
 }
コード例 #22
0
        void GoToInstaller()
        {
#if UNITY_2019_3_OR_NEWER
            PackageManager.UI.Window.Open(k_UdpPackageName);
#else
            AssetStore.Open(k_UdpAssetStoreIdentifier);
#endif
        }
コード例 #23
0
 public static void OpenItemInAssetStore(AssetStoreAsset activeAsset)
 {
     if (activeAsset.id != 0)
     {
         AssetStore.Open(string.Format("content/{0}?assetID={1}", activeAsset.packageID, activeAsset.id));
         UsabilityAnalytics.Track(string.Format("/AssetStore/ViewInStore/{0}/{1}", activeAsset.packageID, activeAsset.id));
     }
 }
コード例 #24
0
 public static void OpenItemInAssetStore(AssetStoreAsset activeAsset)
 {
     if (activeAsset.id == 0)
     {
         return;
     }
     AssetStore.Open(string.Format("content/{0}?assetID={1}", (object)activeAsset.packageID, (object)activeAsset.id));
     Analytics.Track(string.Format("/AssetStore/ViewInStore/{0}/{1}", (object)activeAsset.packageID, (object)activeAsset.id));
 }
コード例 #25
0
ファイル: StatePersister.cs プロジェクト: lanyizi/OpenSAGE
        protected StatePersister(Game game, StatePersistMode mode)
        {
            Segments = new Stack <Segment>();

            Mode = mode;

            Game       = game;
            SageGame   = game.SageGame;
            AssetStore = game.AssetStore;
        }
コード例 #26
0
        public AssetListingViewModel(AssetStore assetStore, Func <IEnumerable <AssetViewModel>, IEnumerable <AssetViewModel> > filterAssets)
        {
            _assetStore   = assetStore;
            _filterAssets = filterAssets;
            _assets       = new ObservableCollection <AssetViewModel>();

            _assetStore.StateChanged += AssetStore_StateChanged;

            ResetAssets();
        }
コード例 #27
0
        public AssetSummaryViewModel(AssetStore assetStore)
        {
            _assetStore = assetStore;

            _topAssets = new ObservableCollection <AssetsViewModel>();

            _assetStore.StateChanged += AssetStore_StateChanged;

            ResetAssets();
        }
コード例 #28
0
        private AssetStore PopulateAssetStoreById(int?assetStoreId)
        {
            AssetStore asset = null;

            if (assetStoreId != null)
            {
                asset = _assetStoreRepository.GetById(assetStoreId.Value);
            }
            return(asset);
        }
コード例 #29
0
 public static WndFile FromFileSystemEntry(FileSystemEntry entry, AssetStore assetStore)
 {
     using (var stream = entry.Open())
         using (var reader = new StreamReader(stream, Encoding.ASCII))
         {
             var source = reader.ReadToEnd();
             var parser = new WndParser(source, assetStore);
             return(parser.ParseFile());
         }
 }
コード例 #30
0
        void PurchaseDeclinedGUI()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.Label(s_AssetStoreLogo, GUIStyle.none, GUILayout.ExpandWidth(false));
            GUILayout.BeginVertical();
            GUILayout.Label("Purchase declined", EditorStyles.boldLabel);
            GUILayout.Label("No money has been drawn from you credit card");

            bool  hasMessage = m_Message != null && m_Message != "";
            float newHeight  = kStandardHeight + (hasMessage ? 20 : 0);

            if (newHeight != position.height)
            {
                position = new Rect(position.x, position.y, position.width, newHeight);
            }

            if (hasMessage)
            {
                GUILayout.Label(m_Message, EditorStyles.wordWrappedLabel);
            }

            GUILayout.Label("Package: " + item.packageName, EditorStyles.wordWrappedLabel);

            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.Space(8);

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close"))
            {
                UsabilityAnalytics.Track(string.Format("/AssetStore/DeclinedAbort/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                Close();
            }
            GUILayout.Space(5);
            if (GUILayout.Button("Put to basket"))
            {
                AssetStore.Open(string.Format("content/{0}/basketpurchase", m_Asset.packageID));
                UsabilityAnalytics.Track(string.Format("/AssetStore/DeclinedPutToBasket/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                Close();
            }
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }