资源简介
GeneralBook.zip
代码片段和文件信息
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
using UnityEditorInternal;
using System;
[CustomEditor(typeof(BookPro))]
public class BookProEditor : Editor
{
ReorderableList list;
Texture tex;
private void OnEnable()
{
tex = AssetDatabase.LoadAssetAtPath(“Assets\\Book-Page Curl\\Editor\\replace.png“ typeof(Texture)) as Texture;
if (tex == null)
{
tex = Texture2D.blackTexture;
}
list = new ReorderableList(serializedobject
serializedobject.FindProperty(“papers“)
true true true true);
list.elementHeight = 75;
list.drawElementCallback = DrawElement;
list.drawHeaderCallback = drawHeader;
list.onAddCallback = addElement;
list.onCanRemoveCallback = canremove;
list.onRemoveCallback = (ReorderableList l) =>
{
if (EditorUtility.DisplayDialog(“Warning!“
“Are you sure you want to delete this Paper?\r\nThe paper pages (front and back) will be deleted from the scene“ “Yes“ “No“))
{
BookPro book = target as BookPro;
if (book.EndFlippingPaper == book.papers.Length - 1)
book.EndFlippingPaper--;
OnInspectorGUI();
Paper paper = book.papers[l.index];
book.LeftPageShadow.gameobject.SetActive(false);
book.LeftPageShadow.transform.SetParent(book.transform);
book.RightPageShadow.gameobject.SetActive(false);
book.RightPageShadow.transform.SetParent(book.transform);
Undo.DestroyobjectImmediate(paper.Back);
Undo.DestroyobjectImmediate(paper.Front);
ReorderableList.defaultBehaviours.DoRemoveButton(l);
EditorUtility.SetDirty(book);
}
};
}
private bool canremove(ReorderableList list)
{
if (list.count == 1)
return false;
return true;
}
private void addElement(ReorderableList list)
{
BookPro book = target as BookPro;
if (book.EndFlippingPaper == book.papers.Length - 1)
{
book.EndFlippingPaper = book.papers.Length;
OnInspectorGUI();
}
list.serializedProperty.arraySize++;
var lastElement = list.serializedProperty.GetArrayElementAtIndex(list.count - 1);
Gameobject rightPage = Instantiate(book.RightPageTransform.gameobject) as Gameobject;
rightPage.transform.SetParent(book.transform true);
rightPage.GetComponent().sizeDelta = book.RightPageTransform.GetComponent().sizeDelta;
rightPage.GetComponent().pivot = book.RightPageTransform.GetComponent().pivot;
rightPage.GetComponent().anchoredPosition = book.RightPageTransfo
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-08-28 17:19 GeneralBook\
目录 0 2017-11-14 14:14 GeneralBook\.git\
文件 59 2017-08-21 17:13 GeneralBook\.gitignore
文件 8 2017-09-30 09:24 GeneralBook\.git\COMMIT_EDITMSG
文件 336 2017-09-30 09:24 GeneralBook\.git\config
文件 73 2017-09-30 09:22 GeneralBook\.git\desc
文件 23 2017-09-30 09:22 GeneralBook\.git\HEAD
目录 0 2017-11-14 14:14 GeneralBook\.git\hooks\
文件 478 2017-09-30 09:22 GeneralBook\.git\hooks\applypatch-msg.sample
文件 896 2017-09-30 09:22 GeneralBook\.git\hooks\commit-msg.sample
文件 189 2017-09-30 09:22 GeneralBook\.git\hooks\post-update.sample
文件 424 2017-09-30 09:22 GeneralBook\.git\hooks\pre-applypatch.sample
文件 1642 2017-09-30 09:22 GeneralBook\.git\hooks\pre-commit.sample
文件 1348 2017-09-30 09:22 GeneralBook\.git\hooks\pre-push.sample
文件 4951 2017-09-30 09:22 GeneralBook\.git\hooks\pre-reba
文件 1239 2017-09-30 09:22 GeneralBook\.git\hooks\prepare-commit-msg.sample
文件 3610 2017-09-30 09:22 GeneralBook\.git\hooks\update.sample
文件 15717 2017-09-30 09:24 GeneralBook\.git\index
目录 0 2017-11-14 14:14 GeneralBook\.git\info\
文件 240 2017-09-30 09:22 GeneralBook\.git\info\exclude
目录 0 2017-11-14 14:14 GeneralBook\.git\logs\
文件 156 2017-09-30 09:24 GeneralBook\.git\logs\HEAD
目录 0 2017-11-14 14:14 GeneralBook\.git\logs\refs\
目录 0 2017-11-14 14:14 GeneralBook\.git\logs\refs\heads\
文件 156 2017-09-30 09:24 GeneralBook\.git\logs\refs\heads\master
目录 0 2017-11-14 14:14 GeneralBook\.git\logs\refs\remotes\
目录 0 2017-11-14 14:14 GeneralBook\.git\logs\refs\remotes\origin\
文件 145 2017-09-30 09:24 GeneralBook\.git\logs\refs\remotes\origin\master
目录 0 2017-11-14 14:14 GeneralBook\.git\ob
目录 0 2017-11-14 14:14 GeneralBook\.git\ob
文件 164 2017-09-30 09:23 GeneralBook\.git\ob
............此处省略1653个文件信息
相关资源
- 源程序.rar
- 29736382Navicat_Premium_11.zip
- 数据结构与算法.zip
- 927迅游破解版.rar
- VisualAssistX.rar
- _CD_源代码.zip
- isd.rar
- GAT1400-2017公安视频图像信息应用系统
- 深度学习.mobi.zip
- PMBOK第六版_中文版带完整目录.pdf
- Location.rar
- grlqsmile_10388665.zip
- 微擎2.0商业版.zip
- 50个著名木马源码灰鸽子冰河广外女生
- gadm36_CHN_shp.zip
- 电路第五版高清.pdf
- HelloWorldDetailEarth3DEngine.pptx
- dyy2546950781_9493974.pdf
- 微博淘宝客软件破解版.zip
- 20307218鸟哥的Linux私房菜第四版高清完
- Grokking-Deep-Learning-master.zip
- messDemo.rar
- 交通咨询管理系统.rar
- 微擎微赞通用功能模块米花同城社区
- eric6_17_12及汉化文件.zip
- Compressedfile.7z
- ANSYSWorkbench设计、仿真与优化[扫描版
- 微擎商业版框架1.8.2.3破解版版.zip
- 算法第4版红皮书可复制版pdf.zip
- KotlininAction中文扫描版.rar
评论
共有 条评论