当前位置: 首页>>代码示例>>C#>>正文


C# Photo.load方法代码示例

本文整理汇总了C#中Photo.load方法的典型用法代码示例。如果您正苦于以下问题:C# Photo.load方法的具体用法?C# Photo.load怎么用?C# Photo.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo.load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getPhotoComment

	//a now deprecated method to get a single comment for a photo
	public string getPhotoComment(Photo p) { 
		//Photo p = new Photo ();
		p.load ();

		if (p.comments.Count == 0) {
			return "";
		} else return p.comments[0];
	}
开发者ID:SamReha,项目名称:SnapshotGame,代码行数:9,代码来源:PostedPhotosManager.cs

示例2: postPhotos

	public void postPhotos() {
		// Get list of photos to post
		List<string> newPhotos = scrollManager.GetComponent<ScrollViewManager>().imagesToPost;

		// Append to player profile and save
		foreach (string imageName in newPhotos) {
			PlayerProfile.profile.postedPhotos.Add(imageName);
			Photo photo = new Photo ();

			photo.pathname = pathToUploadQueue + imageName + ".metaphoto";
			photo.load ();
			PlayerProfile.profile.money += getMoneyFromScore(photo);
			//Debug.Log (photo.balanceValue + ", " + photo.interestingnessValue + ", " + photo.spacingValue);

            // Update Achievements (score based)
            if (photo.balanceValue >= 95.0f) {
                achievementManager.SetProgressToAchievement("Balanced Breakfast", 1.0f);
            }
            if (photo.interestingnessValue >= 95.0f) {
                achievementManager.SetProgressToAchievement("The Most Interesting Photo in The World", 1.0f);
            }
            if (photo.spacingValue >= 95.0f) {
                achievementManager.SetProgressToAchievement("The Final Frontier", 1.0f);
            }
            if (photo.balanceValue >= 95.0f && photo.interestingnessValue >= 95.0f && photo.spacingValue >= 95.0f) {
                achievementManager.SetProgressToAchievement("Perfection Incarnate", 1.0f);
            }

            // Update Achievements (subject or accessory based)
            if (photo.containsOwl && bestScore(photo) >= 50.0f) {
                achievementManager.SetProgressToAchievement("Owl Have What She's Having", 1.0f);
            }

            if (photo.containsFox && bestScore(photo) >= 50.0f) {
                achievementManager.SetProgressToAchievement("What the Fox", 1.0f);
            }

            if (photo.containsDeer && bestScore(photo) >= 50.0f) {
                achievementManager.SetProgressToAchievement("Doe, a Deer, a Female Deer", 1.0f);
            }

            if (photo.takenWithTelephoto && bestScore(photo) >= 50.0f) {
                achievementManager.SetProgressToAchievement("Telemachus", 1.0f);
            }

            if (photo.takenWithWide && bestScore(photo) >= 50.0f) {
                achievementManager.SetProgressToAchievement("Wide Awake", 1.0f);
            }

			if (photo.takenWithFilter && bestScore(photo) >= 50.0f) {
				achievementManager.SetProgressToAchievement("Hipstergram", 1.0f);
			}

			// Debug.Log (imageName);
			// Finally, move the photo from .../Resources/UploadQueue/ to .../Resources/PostedImages/
			File.Move(pathToUploadQueue + imageName + ".metaphoto", pathToPostedPhotos + imageName + ".metaphoto");
			File.Move(pathToUploadQueue + imageName + ".png", pathToPostedPhotos + imageName + ".png");

            if (File.Exists(pathToUploadQueue + imageName + ".metaphoto.meta")) {
                File.Move(pathToUploadQueue + imageName + ".metaphoto.meta", pathToPostedPhotos + imageName + ".metaphoto.meta");
            }
            if (File.Exists(pathToUploadQueue + imageName + ".png.meta")) {
                File.Move(pathToUploadQueue + imageName + ".png.meta", pathToPostedPhotos + imageName + ".png.meta");
            }
        }
		PlayerProfile.profile.save ();

        // Update achievements
        achievementManager.AddProgressToAchievement("Journeyman Photographer", newPhotos.Count);
        achievementManager.AddProgressToAchievement("Experienced Photographer", newPhotos.Count);
        achievementManager.AddProgressToAchievement("Expert Photographer", newPhotos.Count);

        scrollManager.GetComponent<ScrollViewManager> ().updatePostableImages();
		postedPhotosManager.GetComponent<PostedPhotosManager> ().updatePhotos();
		postedPhotosManager.GetComponent<PostedPhotosManager> ().getMetaData();
    }
开发者ID:SamReha,项目名称:SnapshotGame,代码行数:76,代码来源:BlogUIManager.cs

示例3: getMetaData

	public void getMetaData() {
		#if UNITY_EDITOR
		//  Make sure pictures are loaded into resources
		AssetDatabase.Refresh();
		#endif

		DirectoryInfo dir = new DirectoryInfo(pathToPostedPhotos);
		FileInfo[] info = dir.GetFiles("*.metaphoto");
		foreach (FileInfo file in info) {
			Photo photo = new Photo ();
			string filename = file.Name;
			photo.pathname = pathToPostedPhotos +  filename;
			photo.load ();

			Transform child = transform.Find (filename.Replace (".metaphoto", ""));
			GameObject metaData = new GameObject ();
			metaData.transform.position.Set(20f, 0f, 0f);
			Text textData = metaData.AddComponent<Text> ();

			// Configure comments for photo
			if (photo.comments.Count == 0) {
				Debug.Log ("It looks like there are no comments!");
				string markup = "";
				float score = Math.Max(photo.balanceValue, Math.Max(photo.spacingValue, photo.interestingnessValue));
				//Debug.Log (score);
				if (score <= 20f) {
					markup = "bad";
				} else if (score <= 70f) {
					markup = "good";
				} else {
					markup = "perfect";
				}
				photo.comments.Add(gameObject.GetComponent<CommentGenerator>().GenerateComment (markup));
				photo.save ();
			}

			//Debug.Log (filename + " - " + photo.comments [0]);
			BlogUIManager.photoPanel.GetComponentInChildren<Text> ().text = getPhotoComment(photo); //spacing the comments

			textData.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
			metaData.GetComponent<RectTransform> ().position = new Vector3 (0f, -90f, 0f);
			metaData.transform.SetParent (child, false);
		}
	}
开发者ID:SamReha,项目名称:SnapshotGame,代码行数:44,代码来源:PostedPhotosManager.cs


注:本文中的Photo.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。