예제 #1
0
        public NSMutableArray GetCustomButtons(UIViewController controllerReference)
        {
            NSMutableArray <UIView> array = new NSMutableArray <UIView>();

            array.AddObjects(GetButtonView(controllerReference));
            return(array);
        }
 void AddUser(string user)
 {
     _users.AddObjects(new NSString(user));
     PutUsersToSettingsStore();
     _trainTapMode = TrainTapMode.UserSelect;
     ShowChooseTrainAlert(user);
 }
예제 #3
0
        // Shared initialization code
        void Initialize()
        {
            viewControllers = new NSMutableArray();

            var dvc = new DepartmentViewController();
            var evc = new EmployeeViewController();

            viewControllers.AddObjects(new NSObject[] { dvc, evc });

            DataStore.LoadItemsFromDatabase();
        }
        public void AddObjectsTest()
        {
            var v1 = (NSString)"1";
            var v2 = (NSString)"2";
            var v3 = (NSString)"3";

            using (var arr = new NSMutableArray <NSString> ()) {
                Assert.Throws <ArgumentNullException> (() => arr.AddObjects((NSString[])null), "AddObjects ANE 1");
                Assert.AreEqual(0, arr.Count, "Count 1");

                Assert.Throws <ArgumentNullException> (() => arr.AddObjects(new NSString [] { null }), "AddObjects ANE 2");
                Assert.AreEqual(0, arr.Count, "Count 2");

                Assert.Throws <ArgumentNullException> (() => arr.AddObjects(new NSString [] { v1, null, v3 }), "AddObjects ANE 3");
                Assert.AreEqual(0, arr.Count, "Count 3");

                arr.AddObjects(v1, v2);
                Assert.AreEqual(2, arr.Count, "AddObjects 1");
                Assert.AreSame(v1, arr [0], "a [0]");
                Assert.AreSame(v2, arr [1], "a [1]");
            }
        }
예제 #5
0
        public void LoadCheats(NSWindow window)
        {
            var dlg = NSOpenPanel.OpenPanel;

            dlg.CanChooseFiles       = true;
            dlg.CanChooseDirectories = false;

            if (dlg.RunModal() == 1)
            {
                var serializer = new CheatSerializer();
                var items      = new NSMutableArray();
                items.AddObjects(serializer.Load(dlg.Url.Path).ToArray());
                SetCheat(items);
            }
        }
예제 #6
0
        // Shared initialization code
        void Initialize()
        {
            viewControllers = new NSMutableArray();

            var dvc = new DepartmentViewController();
            var evc = new EmployeeViewController();
            viewControllers.AddObjects(new NSObject[]{dvc, evc});

            DataStore.LoadItemsFromDatabase();
        }
예제 #7
0
        public override void PresentStep(int index, PresentationViewController presentationViewController)
        {
            switch (index)
            {
            case 0:
                break;

            case 1:
                TextManager.FlipOutText(SlideTextManager.TextType.Bullet);
                TextManager.FlipOutText(SlideTextManager.TextType.Code);

                TextManager.AddBulletAtLevel("Image", 0);
                TextManager.AddBulletAtLevel("Name / Path / URL", 1);
                TextManager.AddBulletAtLevel("NSImage / UIImage / NSData", 1);
                TextManager.AddBulletAtLevel("SKTexture", 1);

                TextManager.FlipInText(SlideTextManager.TextType.Bullet);


                var code = TextManager.AddCode("#material.diffuse.contents = #@\"slate.jpg\"#;#");
                code.Position = new SCNVector3(code.Position.X + 6, code.Position.Y - 6.5f, code.Position.Z);

                Material.Diffuse.Contents = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/slate", "jpg"));
                Material.Normal.Contents  = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/slate-bump", "png"));
                Material.Normal.Intensity = 0;
                break;

            case 2:
                SCNTransaction.Begin();
                SCNTransaction.AnimationDuration = 1.0f;
                Material.Normal.Intensity        = 5.0f;
                Material.Specular.Contents       = NSColor.Gray;
                SCNTransaction.Commit();

                code          = TextManager.AddCode("#material.normal.contents = #[SKTexture textureByGeneratingNormalMap]#;#");
                code.Position = new SCNVector3(code.Position.X + 2, code.Position.Y - 6.5f, code.Position.Z);
                break;

            case 3:
                TextManager.FadeOutText(SlideTextManager.TextType.Code);
                TextManager.FlipOutText(SlideTextManager.TextType.Bullet);
                TextManager.AddBulletAtLevel("Live contents", 0);
                TextManager.AddBulletAtLevel("CALayer tree", 1);
                TextManager.AddBulletAtLevel("SKScene (new)", 1);
                TextManager.FlipInText(SlideTextManager.TextType.Bullet);

                SCNTransaction.Begin();
                SCNTransaction.AnimationDuration = 1.0f;
                Material.Normal.Intensity        = 2.0f;
                SCNTransaction.Commit();

                PlayerLayer1 = ConfigurePlayer(NSBundle.MainBundle.PathForResource("Movies/movie1", "mov"), "material-cube");
                break;

            case 4:
                TextManager.FlipOutText(SlideTextManager.TextType.Bullet);
                TextManager.AddEmptyLine();

                TextManager.AddBulletAtLevel("Cube map", 0);
                TextManager.AddBulletAtLevel("NSArray of 6 items", 1);
                TextManager.FlipInText(SlideTextManager.TextType.Bullet);

                code          = TextManager.AddCode("#material.reflective.contents = #@[aright.png, left.png ... front.png]#;#");
                code.Position = new SCNVector3(code.Position.X, code.Position.Y - 9.5f, code.Position.Z);

                var image = Utils.SCPlaneNode(NSBundle.MainBundle.PathForResource("Images/cubemap", "png"), 12, false);
                image.Position = new SCNVector3(-10, 9, 0);
                image.Opacity  = 0;
                ContentNode.AddChildNode(image);

                Object.Geometry = SCNTorus.Create(W * 0.5f, W * 0.2f);
                Material        = Object.Geometry.FirstMaterial;
                Object.Rotation = new SCNVector4(1, 0, 0, (float)Math.PI / 2);

                SCNTransaction.Begin();
                SCNTransaction.AnimationDuration = 1;
                var right            = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/right", "tga"));
                var left             = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/left", "tga"));
                var top              = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/top", "tga"));
                var bottom           = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/bottom", "tga"));
                var back             = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/back", "tga"));
                var front            = new NSImage(NSBundle.MainBundle.PathForResource("SharedTextures/front", "tga"));
                var materialContents = new NSMutableArray();
                materialContents.AddObjects(new NSObject[] { right, left, top, bottom, back, front });
                Material.Reflective.Contents = materialContents;
                Material.Diffuse.Contents    = NSColor.Red;
                image.Opacity = 1.0f;
                SCNTransaction.Commit();
                break;
            }
        }
예제 #8
0
		public override void PresentStep (int index, PresentationViewController presentationViewController)
		{
			switch (index) {
			case 0:
				break;
			case 1:
				TextManager.FlipOutText (SlideTextManager.TextType.Bullet);
				TextManager.FlipOutText (SlideTextManager.TextType.Code);

				TextManager.AddBulletAtLevel ("Image", 0);
				TextManager.AddBulletAtLevel ("Name / Path / URL", 1);
				TextManager.AddBulletAtLevel ("NSImage / UIImage / NSData", 1);
				TextManager.AddBulletAtLevel ("SKTexture", 1);

				TextManager.FlipInText (SlideTextManager.TextType.Bullet);


				var code = TextManager.AddCode ("#material.diffuse.contents = #@\"slate.jpg\"#;#");
				code.Position = new SCNVector3 (code.Position.X + 6, code.Position.Y - 6.5f, code.Position.Z);

				Material.Diffuse.Contents = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/slate", "jpg"));
				Material.Normal.Contents = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/slate-bump", "png"));
				Material.Normal.Intensity = 0;
				break;
			case 2:
				SCNTransaction.Begin ();
				SCNTransaction.AnimationDuration = 1.0f;
				Material.Normal.Intensity = 5.0f;
				Material.Specular.Contents = NSColor.Gray;
				SCNTransaction.Commit ();

				code = TextManager.AddCode ("#material.normal.contents = #[SKTexture textureByGeneratingNormalMap]#;#");
				code.Position = new SCNVector3 (code.Position.X + 2, code.Position.Y - 6.5f, code.Position.Z);
				break;
			case 3:
				TextManager.FadeOutText (SlideTextManager.TextType.Code);
				TextManager.FlipOutText (SlideTextManager.TextType.Bullet);
				TextManager.AddBulletAtLevel ("Live contents", 0);
				TextManager.AddBulletAtLevel ("CALayer tree", 1);
				TextManager.AddBulletAtLevel ("SKScene (new)", 1);
				TextManager.FlipInText (SlideTextManager.TextType.Bullet);

				SCNTransaction.Begin ();
				SCNTransaction.AnimationDuration = 1.0f;
				Material.Normal.Intensity = 2.0f;
				SCNTransaction.Commit ();

				PlayerLayer1 = ConfigurePlayer (NSBundle.MainBundle.PathForResource ("Movies/movie1", "mov"), "material-cube");
				break;
			case 4:
				TextManager.FlipOutText (SlideTextManager.TextType.Bullet);
				TextManager.AddEmptyLine ();

				TextManager.AddBulletAtLevel ("Cube map", 0);
				TextManager.AddBulletAtLevel ("NSArray of 6 items", 1);
				TextManager.FlipInText (SlideTextManager.TextType.Bullet);

				code = TextManager.AddCode ("#material.reflective.contents = #@[aright.png, left.png ... front.png]#;#");
				code.Position = new SCNVector3 (code.Position.X, code.Position.Y - 9.5f, code.Position.Z);

				var image = Utils.SCPlaneNode (NSBundle.MainBundle.PathForResource ("Images/cubemap", "png"), 12, false);
				image.Position = new SCNVector3 (-10, 9, 0);
				image.Opacity = 0;
				ContentNode.AddChildNode (image);

				Object.Geometry = SCNTorus.Create (W * 0.5f, W * 0.2f);
				Material = Object.Geometry.FirstMaterial;
				Object.Rotation = new SCNVector4 (1, 0, 0, NMath.PI / 2);

				SCNTransaction.Begin ();
				SCNTransaction.AnimationDuration = 1;
				var right = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/right", "tga"));
				var left = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/left", "tga"));
				var top = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/top", "tga"));
				var bottom = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/bottom", "tga"));
				var back = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/back", "tga"));
				var front = new NSImage (NSBundle.MainBundle.PathForResource ("SharedTextures/front", "tga"));
				var materialContents = new NSMutableArray ();
				materialContents.AddObjects (new NSObject[] { right, left, top, bottom, back, front });
				Material.Reflective.Contents = materialContents;
				Material.Diffuse.Contents = NSColor.Red;
				image.Opacity = 1.0f;
				SCNTransaction.Commit ();
				break;
			}
		}
예제 #9
0
		//present physics field slide
		void ShowPhysicsFields ()
		{
			var dz = 50f;

			SCNTransaction.Begin ();
			SCNTransaction.AnimationDuration = 0.75f;
			SpotLightNode.Light.Color = SKColorHelper.FromCommonWhiteAlpha (0.5f, 1.0f);
			AmbientLightNode.Light.Color = SKColor.Black;
			SCNTransaction.Commit ();

			//remove gravity for this slide
			Scene.PhysicsWorld.Gravity = SCNVector3.Zero;

			//move camera
			var tr = SCNAction.MoveBy (new SCNVector3 (0, 0, dz), 1);
			tr.TimingMode = SCNActionTimingMode.EaseInEaseOut;
			CameraHandle.RunAction (tr);

			//add particles
			FieldEmitter = SCNNode.Create ();
			FieldEmitter.Position = new SCNVector3 (CameraHandle.Position.X, 5, dz);

			var ps = SCNParticleSystem.Create ("bubbles.scnp", "assets.scnassets/particles/");

			ps.ParticleColor = SKColorHelper.FromCommonRGBA (0.8f, 0, 0, 1.0f);
			ps.ParticleColorVariation = new SCNVector4 (0.3f, 0.2f, 0.3f, 0.0f);
			ps.SortingMode = SCNParticleSortingMode.Distance;
			ps.BlendMode = SCNParticleBlendMode.Alpha;
			#if __IOS__
			var right = new UIImage ("images/cubemap/right.jpg");
			var left = new UIImage ("images/cubemap/left.jpg");
			var top = new UIImage ("images/cubemap/top.jpg");
			var bottom = new UIImage ("images/cubemap/bottom.jpg");
			var front = new UIImage ("images/cubemap/front.jpg");
			var back = new UIImage ("images/cubemap/back.jpg");
			#else
			var right = new NSImage (NSBundle.MainBundle.PathForResource ("images/cubemap/right", "jpg"));
			var left = new NSImage (NSBundle.MainBundle.PathForResource ("images/cubemap/left", "jpg"));
			var top = new NSImage (NSBundle.MainBundle.PathForResource ("images/cubemap/top", "jpg"));
			var bottom = new NSImage (NSBundle.MainBundle.PathForResource ("images/cubemap/bottom", "jpg"));
			var front = new NSImage (NSBundle.MainBundle.PathForResource ("images/cubemap/front", "jpg"));
			var back = new NSImage (NSBundle.MainBundle.PathForResource ("images/cubemap/back", "jpg"));
			#endif
			var cubMap = new NSMutableArray ();
			cubMap.AddObjects (new NSObject[] { right, left, top, bottom, front, back });
			ps.ParticleImage = cubMap;
			ps.FresnelExponent = 2;
			ps.ColliderNodes = new [] { FloorNode, MainWall };

			ps.EmitterShape = SCNBox.Create (200, 0, 100, 0);

			FieldEmitter.AddParticleSystem (ps);
			Scene.RootNode.AddChildNode (FieldEmitter);

			//field
			FieldOwner = SCNNode.Create ();
			FieldOwner.Position = new SCNVector3 (CameraHandle.Position.X, 50, dz + 5);

			var field = SCNPhysicsField.CreateRadialGravityField ();
			field.HalfExtent = new SCNVector3 (100, 100, 100);
			field.MinimumDistance = 20.0f;
			field.FalloffExponent = 0;
			FieldOwner.PhysicsField = field;
			FieldOwner.PhysicsField.Strength = 0.0f;
			Scene.RootNode.AddChildNode (FieldOwner);
		}