Installed book plugin, fixed compiler errors
This commit is contained in:
38
Assets/External/Book-Page Curl Pro/Examples/scripts/AddPagesDynamically.cs
vendored
Normal file
38
Assets/External/Book-Page Curl Pro/Examples/scripts/AddPagesDynamically.cs
vendored
Normal 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
19
Assets/External/Book-Page Curl Pro/Examples/scripts/AddPagesDynamically.cs.meta
vendored
Normal file
19
Assets/External/Book-Page Curl Pro/Examples/scripts/AddPagesDynamically.cs.meta
vendored
Normal 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
|
||||
34
Assets/External/Book-Page Curl Pro/Examples/scripts/BotAnimationControl.cs
vendored
Normal file
34
Assets/External/Book-Page Curl Pro/Examples/scripts/BotAnimationControl.cs
vendored
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Book-Page Curl Pro/Examples/scripts/BotAnimationControl.cs.meta
vendored
Normal file
19
Assets/External/Book-Page Curl Pro/Examples/scripts/BotAnimationControl.cs.meta
vendored
Normal 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
|
||||
24
Assets/External/Book-Page Curl Pro/Examples/scripts/FastForwardFlipper.cs
vendored
Normal file
24
Assets/External/Book-Page Curl Pro/Examples/scripts/FastForwardFlipper.cs
vendored
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Assets/External/Book-Page Curl Pro/Examples/scripts/FastForwardFlipper.cs.meta
vendored
Normal file
19
Assets/External/Book-Page Curl Pro/Examples/scripts/FastForwardFlipper.cs.meta
vendored
Normal 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
|
||||
Reference in New Issue
Block a user