public void Decorate(GameObject go, Asset asset, AssetBundle assetBundle)
        {
            BillBoard deco = go.GetComponent <BillBoard>() ?? go.AddComponent <BillBoard>();

            deco.buildOnLayerMask        = 4096;
            deco.buildOnGrid             = asset.BuildOnGrid;
            deco.heightChangeDelta       = asset.HeightDelta;
            deco.defaultGridSubdivision  = asset.GridSubdivision;
            deco.defaultSnapToGridCenter = asset.SnapCenter;
            if (string.IsNullOrEmpty(asset.SubCategory))
            {
                deco.categoryTag = asset.Category;
            }
            else
            {
                deco.categoryTag = asset.Category + "/" + asset.SubCategory;
            }

            deco.canSeeThrough = asset.SeeThrough;
            deco.canBlockRain  = asset.BlocksRain;
            if (asset.IsResizable)
            {
                CustomSize customSize = go.AddComponent <CustomSize>();
                customSize.minSize = asset.MinSize;
                customSize.maxSize = asset.MaxSize;
            }
        }
示例#2
0
        public void CreateFromClases_ThenTest_SampleCustomSizes()
        {
            var smallBloodOil = new CustomSize()
            {
                ItemID = TechType.BloodOil.ToString(),
                Width  = 1,
                Height = 1
            };

            var smallMelon = new CustomSize()
            {
                ItemID = TechType.BulboTreePiece.ToString(),
                Width  = 1,
                Height = 1
            };

            var smallPotatoe = new CustomSize()
            {
                ItemID = TechType.PurpleVegetable.ToString(),
                Width  = 1,
                Height = 1
            };

            var origCustSizes = new CustomSizeList
            {
                smallBloodOil,
                smallMelon,
                smallPotatoe
            };

            string serialized = origCustSizes.PrettyPrint();

            string samples2File = SampleFileDirectory + "CustomSizes_Samples2.txt";

            File.WriteAllText(samples2File, serialized);

            var readingSizesList = new CustomSizeList();

            string reserialized = File.ReadAllText(samples2File);

            bool success = readingSizesList.FromString(reserialized);

            Assert.IsTrue(success);

            Assert.AreEqual(origCustSizes.Count, readingSizesList.Count);

            Assert.AreEqual(TechType.BloodOil.ToString(), readingSizesList[0].ItemID);
            Assert.AreEqual(TechType.BulboTreePiece.ToString(), readingSizesList[1].ItemID);
            Assert.AreEqual(TechType.PurpleVegetable.ToString(), readingSizesList[2].ItemID);

            Assert.AreEqual(1, readingSizesList[0].Width);
            Assert.AreEqual(1, readingSizesList[0].Height);
            Assert.AreEqual(1, readingSizesList[1].Width);
            Assert.AreEqual(1, readingSizesList[1].Height);
            Assert.AreEqual(1, readingSizesList[2].Width);
            Assert.AreEqual(1, readingSizesList[2].Height);
        }
示例#3
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.BKE_Layout);
			// Create your application here
			screen_size = Util.DetectScreenSize ();
			if (bundle == null) {
				Start ();
			}
		}
示例#4
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.BKE_Layout);
     // Create your application here
     screen_size = Util.DetectScreenSize();
     if (bundle == null)
     {
         Start();
     }
 }
        public TSelf Resizable(float min, float max)
        {
            AddStep("RESIZABLE", (payload) =>
            {
                CustomSize customSize = payload.Go.GetComponent <CustomSize>();
                if (customSize == null)
                {
                    customSize = payload.Go.AddComponent <CustomSize>();
                }

                customSize.minSize = min;
                customSize.maxSize = max;
            });
            return(this as TSelf);
        }
示例#6
0
        public void Deserialize_CustomSize_FullDetails()
        {
            const string serialized = "CustomSize:" + "\r\n" +
                                      "(" + "\r\n" +
                                      "    ItemID:Aerogel;" + "\r\n" +
                                      "    Width:3;" + "\r\n" +
                                      "    Height:4;" + "#THIS IS A COMMENT#" + "\r\n" +
                                      ");" + "\r\n";

            var size = new CustomSize();

            size.FromString(serialized);

            Assert.AreEqual(TechType.Aerogel.ToString(), size.ItemID);
            Assert.AreEqual(3, size.Width);
            Assert.AreEqual(4, size.Height);
        }
示例#7
0
 public Settings()
 {
     SelectedSizeIndex  = 0;
     ShrinkOnly         = false;
     Replace            = false;
     IgnoreOrientation  = true;
     JpegQualityLevel   = 90;
     PngInterlaceOption = System.Windows.Media.Imaging.PngInterlaceOption.Default;
     TiffCompressOption = System.Windows.Media.Imaging.TiffCompressOption.Default;
     FileName           = "%1 (%2)";
     Sizes = new ObservableCollection <ResizeSize>
     {
         new ResizeSize("$small$", ResizeFit.Fit, 854, 480, ResizeUnit.Pixel),
         new ResizeSize("$medium$", ResizeFit.Fit, 1366, 768, ResizeUnit.Pixel),
         new ResizeSize("$large$", ResizeFit.Fit, 1920, 1080, ResizeUnit.Pixel),
         new ResizeSize("$phone$", ResizeFit.Fit, 320, 568, ResizeUnit.Pixel),
     };
     KeepDateModified = false;
     FallbackEncoder  = new System.Guid("19e4a5aa-5662-4fc5-a0c0-1758028e1057");
     CustomSize       = new CustomSize(ResizeFit.Fit, 1024, 640, ResizeUnit.Pixel);
     AllSizes         = new AllSizesCollection(this);
 }
示例#8
0
        public void AllSizesHandlesPropertyEventsForCustomSize()
        {
            var originalCustomSize = new CustomSize();
            var settings           = new Settings
            {
                Sizes      = new ObservableCollection <ResizeSize>(),
                CustomSize = originalCustomSize,
            };
            var ncc = (INotifyCollectionChanged)settings.AllSizes;

            var result = AssertEx.Raises <NotifyCollectionChangedEventArgs>(
                h => ncc.CollectionChanged += h,
                h => ncc.CollectionChanged -= h,
                () => settings.CustomSize   = new CustomSize());

            Assert.Equal(NotifyCollectionChangedAction.Replace, result.Arguments.Action);
            Assert.Equal(1, result.Arguments.NewItems.Count);
            Assert.Equal(settings.CustomSize, result.Arguments.NewItems[0]);
            Assert.Equal(0, result.Arguments.NewStartingIndex);
            Assert.Equal(1, result.Arguments.OldItems.Count);
            Assert.Equal(originalCustomSize, result.Arguments.OldItems[0]);
            Assert.Equal(0, result.Arguments.OldStartingIndex);
        }
示例#9
0
        public void CanSetQualityLevel()
        {
            // Arrange
            var size
                = new CustomSize
                {
                Width  = 96,
                Height = 96
                };
            var sourceFile = "WP_000000.jpg";
            var resizer1   = CreateResizer(size, qualityLevel: 1);
            var resizer2   = CreateResizer(size, qualityLevel: 100);

            // Act
            var file1 = resizer1.Resize(sourceFile);
            var file2 = resizer2.Resize(sourceFile);

            // Assert
            var fileLength1 = new FileInfo(file1).Length;
            var fileLength2 = new FileInfo(file2).Length;

            Assert.True(fileLength1 < fileLength2);
        }