Installed book plugin, fixed compiler errors

This commit is contained in:
journaliciouz
2025-11-05 12:03:39 +01:00
parent 92c08da136
commit 9c8eababb3
122 changed files with 33679 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using UnityEngine;
namespace BookCurlPro.Examples
{
/// <summary>
/// How to use it:
/// 1) Create a new gameobject in the scene and attach this script on it
/// 2) Create a prefab for the front and back pages(should be similar to the the page object that is created by the editor and has the same components)
/// 3) Assign the front and back prefabs to this component
/// 4) Call the function AddPaper when you want to add a new paper in the book
/// 5) you may need to customize this function to add a paper in specific position in the book or to change some parts of the front and back prefabs dynamically
/// </summary>
public class AddPagesDynamically : MonoBehaviour
{
public GameObject FrontPagePrefab;
public GameObject BackPagePrefab;
public void AddPaper(BookPro book)
{
GameObject frontPage = Instantiate(FrontPagePrefab);
GameObject backPage = Instantiate(BackPagePrefab);
frontPage.transform.SetParent(book.transform, false);
backPage.transform.SetParent(book.transform, false);
Paper newPaper = new Paper();
newPaper.Front = frontPage;
newPaper.Back = backPage;
Paper[] papers = new Paper[book.papers.Length + 1];
for (int i = 0; i < book.papers.Length; i++)
{
papers[i] = book.papers[i];
}
papers[papers.Length - 1] = newPaper;
book.papers = papers;
//update the flipping range to contain the new added paper
book.EndFlippingPaper = book.papers.Length - 1;
book.UpdatePages();
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 66589c8459059eb4ebd850acafad7dda
timeCreated: 1574018080
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 77222
packageName: Book - Page Curl Pro
packageVersion: 2.3
assetPath: Assets/Book-Page Curl Pro/Examples/scripts/AddPagesDynamically.cs
uploadId: 688704

View File

@@ -0,0 +1,34 @@
using UnityEngine;
using System.Collections;
namespace BookCurlPro.Examples
{
public class BotAnimationControl : MonoBehaviour
{
public Animator anim;
// Use this for initialization
void Start()
{
if (!anim)
anim = GetComponent<Animator>();
}
public void Close()
{
anim.ResetTrigger("Open");
anim.ResetTrigger("Close");
anim.SetTrigger("Close");
}
public void Open()
{
anim.ResetTrigger("Close");
anim.ResetTrigger("Open");
anim.SetTrigger("Open");
}
// Update is called once per frame
void Update()
{
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 6eb24af4ce395274c99d9ae179040a0c
timeCreated: 1479139378
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 77222
packageName: Book - Page Curl Pro
packageVersion: 2.3
assetPath: Assets/Book-Page Curl Pro/Examples/scripts/BotAnimationControl.cs
uploadId: 688704

View File

@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BookCurlPro;
namespace BookCurlPro.Examples
{
public class FastForwardFlipper : MonoBehaviour
{
public AutoFlip flipper;
BookPro book;
public InputField pageNumInputField;
public void GotoPage()
{
int pageNum = int.Parse(pageNumInputField.text);
if (pageNum < 0) pageNum = 0;
if (pageNum > flipper.ControledBook.papers.Length * 2) pageNum = flipper.ControledBook.papers.Length * 2 - 1;
flipper.enabled = true;
flipper.PageFlipTime = 0.2f;
flipper.TimeBetweenPages = 0;
flipper.StartFlipping((pageNum + 1) / 2);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 4c6868bbfbc05cd4693cebc0104342c9
timeCreated: 1574002473
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 77222
packageName: Book - Page Curl Pro
packageVersion: 2.3
assetPath: Assets/Book-Page Curl Pro/Examples/scripts/FastForwardFlipper.cs
uploadId: 688704