Compare commits

..

766 Commits

Author SHA1 Message Date
b830b5961a 最新打包配置;适配wahoo 2022-08-29 11:12:53 +08:00
74bdd26924 删除模型 2022-07-26 13:48:49 +08:00
0bd5f325de 修复我的上传bug 2022-07-22 13:29:01 +08:00
8e9d49c921 附近的人与线路查询优化&登出取消设备资源释放 2022-07-21 17:45:26 +08:00
200566163a 连接功率计无法开始问题&附近的人优化 2022-07-21 14:51:26 +08:00
9d3de1e97c 解决我的收藏选择集合后其他分类也显示收藏列表 2022-07-20 17:02:10 +08:00
ad8c4c8674 修复登出设备连接释放资源bug 2022-07-20 15:04:52 +08:00
d3f1af9b8b Merge remote-tracking branch 'origin/dev_release' into dev_release 2022-07-20 13:47:16 +08:00
32c644fde8 用户下线出现提示bug 2022-07-20 13:47:10 +08:00
9b656e9852 解决第二次断开设备失败问题 2022-07-20 13:27:47 +08:00
2274a13619 设备断开优化 2022-07-20 10:44:47 +08:00
63987511e7 解决设备连接问题 2022-07-19 18:46:01 +08:00
629e27f5cd 分享闪退 2022-07-19 17:55:06 +08:00
7f56624ec7 设备扫描优化&我的收藏返回记忆位置 2022-07-19 15:47:43 +08:00
c209811f9f 删除账号优化 2022-07-18 18:37:42 +08:00
e6fbad7021 Merge remote-tracking branch 'origin/dev_cyp' into dev_release 2022-07-18 17:14:43 +08:00
71ae54aabe ios连接错误回调信息微调 2022-07-18 17:14:30 +08:00
3e80edf0dc 注销用户两步+删除用户线路 2022-07-18 17:14:30 +08:00
99e916905d 注销用户两步+删除用户线路 2022-07-18 17:14:29 +08:00
be4e741708 注销用户两步+删除用户线路 2022-07-18 17:07:02 +08:00
5b39dd985b 结果页面移除划船记录&设备断开扔保留之前的厂商序列号 2022-07-18 14:31:14 +08:00
2697103479 Merge branch 'dev_lishuo' into dev_release 2022-07-18 11:06:52 +08:00
68071a95f6 消息点问题 2022-07-18 10:10:40 +08:00
867b61fc00 被登出时主动释放资源 2022-07-15 14:39:24 +08:00
c5fb7b93a3 移动端删除账号 2022-07-15 14:33:59 +08:00
ae753e51cb Merge remote-tracking branch 'origin/dev_combine' into dev_release
# Conflicts:
#	Assets/Scripts/App.cs
2022-07-15 14:28:37 +08:00
46b4c01730 移动端划船机移除 2022-07-15 14:28:37 +08:00
3207d7b191 删除用户pc 2022-07-15 14:27:05 +08:00
bf3b0d2642 Merge remote-tracking branch 'origin/dev_combine' into dev_release
# Conflicts:
#	Assets/Scenes/Test.unity
#	Assets/SoftMaskForUGUI-1.0.2/Samples~/Demo/Mobile.meta
2022-07-15 13:35:28 +08:00
eeb9a42c83 删除用户暂存 2022-07-15 13:34:43 +08:00
4d0a383a88 移除划船机相关内容 2022-07-15 13:07:23 +08:00
29625182c3 新增softMaskForUGUI插件 2022-07-15 10:40:25 +08:00
576a770c7b 登录失效问题 2022-07-14 18:10:58 +08:00
f92818885e 关闭测试功率 2022-07-14 14:39:06 +08:00
dc4868bfee 忽略packages改动 2022-07-14 14:25:54 +08:00
e80b7ab1f1 Revert "微调"
This reverts commit 15f458d507f8bf26a5f3ab66149ab794a517e3d7.

# Conflicts:
#	.gitignore
2022-07-14 14:20:39 +08:00
a588716b30 解决io设备连接&android卡顿问题 2022-07-14 13:37:33 +08:00
342740b740 Merge branch 'dev_cyp1' into dev_combine
# Conflicts:
#	.gitignore
#	Assets/Scripts/Devices/Ble/Characteristic/C2RowerData.cs
#	Assets/Scripts/Scenes/MainController.cs
2022-07-11 14:52:54 +08:00
fccc830f71 发布前微调 2022-07-08 18:55:27 +08:00
bd9696cd81 android端发布前微调 2022-07-06 17:48:55 +08:00
38a736a259 gitignore更新 2022-07-04 10:36:40 +08:00
11693c40af 忽略video插件 2022-06-30 14:43:01 +08:00
4d4f8feb8b c2课程同步 2022-06-30 14:39:13 +08:00
46f7c2d4b1 解决阻力设置点击无效的bug 2022-06-28 11:03:10 +08:00
d38330d969 人物动画控制器调整&视频编辑器字体调整 2022-06-28 10:02:50 +08:00
9e2240fd9b 视频编辑工具合并后字体调整 2022-06-27 13:37:13 +08:00
1d015706db Merge branch 'dev_cyp1' into dev_ar_cyp
# Conflicts:
#	Assets/Plugins/Android/unityandroidbluetoothlelib.jar
#	Assets/Resources/UI/language.json
#	Assets/Scenes/MainScene.unity
#	Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs
#	Assets/Scripts/Devices/Ble/mobile/BleMobileThread.cs
#	Assets/Scripts/Scenes/MainController.cs
#	Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs
#	Assets/Scripts/UI/Prefab/Rower/RowerDeviceView.cs
#	Assets/Scripts/UI/Prefab/Rower/RowerGraphChartFeed.cs
#	Assets/Scripts/UIManager.cs
2022-06-27 10:36:20 +08:00
06b9051b3c c2同步课程命令 2022-06-24 18:03:36 +08:00
701ec3069b C2课程同步问题 2022-06-23 18:55:08 +08:00
84b3e1e7a4 移除测试代码 2022-06-21 18:55:13 +08:00
573b96d86c 拉力曲线性能优化&解决划船时间误差问题 2022-06-21 17:49:43 +08:00
6c9b3f825a 解决没有设备号的问题 2022-06-15 18:07:06 +08:00
6e091bd99c anroid ble jar包调整 2022-06-15 16:58:22 +08:00
610c98f9b8 解决c2表头设定课程后抖动问题,设备断开失败问题 2022-06-15 16:42:07 +08:00
0202814f67 心率,阻力逻辑调整 2022-06-14 18:37:58 +08:00
f25d0b7b8c 蓝牙断开重连相关逻辑优化 2022-06-13 18:59:02 +08:00
87a0e7fb6d 划船机优化 2022-06-10 19:31:07 +08:00
2f64aa494f 移动端蓝牙优化 2022-06-09 14:52:50 +08:00
72f254af2a 蓝牙重复初始化问题 2022-06-09 14:52:45 +08:00
6542dd9882 移动端蓝牙优化 2022-06-09 14:51:03 +08:00
5b54255777 蓝牙重复初始化问题 2022-06-08 18:27:16 +08:00
6b3dd70c61 设备连接界面断开逻辑调整 2022-06-08 17:25:02 +08:00
1c9102fbdc 设备连接界面断开逻辑调整 2022-06-08 17:24:35 +08:00
46b6c7fa01 设备连接稳定性 2022-06-08 16:22:07 +08:00
c333086e30 重置问题 2022-06-08 13:55:35 +08:00
02d2dcdbf7 设备连接稳定性 2022-06-08 13:05:56 +08:00
c7afcbb01f Merge branch 'dev_cyp' into dev_cyp1
# Conflicts:
#	Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs
2022-06-07 11:32:46 +08:00
ff878d5d50 修改断线重连自动开始问题 2022-06-07 11:32:23 +08:00
b236e939f4 graph优化
# Conflicts:
#	Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs
2022-06-06 19:55:08 +08:00
bfc56dded5 0606修改 2022-06-06 18:54:28 +08:00
383fed4966 graph优化 2022-06-06 18:54:04 +08:00
6effadc1e9 增加长时间保存,解决取影子以后后续请求失效问题(使用unity的请求库) 2022-06-06 09:09:20 +08:00
c6d0f7ac13 合并后错误修改 2022-06-02 18:05:41 +08:00
d498dd9148 日志包 2022-06-02 15:52:10 +08:00
e513eeac5c Merge branch 'dev_cyp' into dev_ar_cyp
# Conflicts:
#	Assets/Resources/UI/Font/HanWangZonYi.ttf.meta
#	Assets/Resources/UI/language.json
#	Assets/Scenes/Login.unity
#	Assets/Scripts/Apis/Models/MapRoute.cs
#	Assets/Scripts/App.cs
#	Assets/Scripts/ConfigHelper.cs
#	Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs
#	Assets/Scripts/UIManager.cs
#	Assets/Scripts/Utils/Utils.cs
2022-06-02 11:30:37 +08:00
71c9907c89 UImanager show方法会产生多余的HomeController 2022-06-01 19:49:15 +08:00
154252e3c3 Merge remote-tracking branch 'origin/dev_ani3' into dev_cyp 2022-06-01 16:24:36 +08:00
cda569afd5 性能优化 2022-06-01 16:10:42 +08:00
475250e795 Merge remote-tracking branch 'origin/dev_ani3' into dev_cyp 2022-06-01 16:10:35 +08:00
c579c1b130 Merge remote-tracking branch 'origin/dev_cyp' into dev_ani3 2022-06-01 10:50:16 +08:00
d9848e4e9d 设备连接界面微调&划船机本地记录过滤 2022-06-01 10:24:23 +08:00
622aaa3b6d 重连后续修改 2022-06-01 09:54:20 +08:00
e7af21b126 pc设备连接界面微调 2022-05-31 19:43:50 +08:00
bfa9f5f998 Merge remote-tracking branch 'origin/dev_ani3' into dev_cyp 2022-05-31 18:42:13 +08:00
3f8c189ad4 断线重连取数据逻辑 2022-05-31 18:40:32 +08:00
a1010091f8 设备连接界面文案与交互调整 2022-05-31 18:25:53 +08:00
167a424505 Merge remote-tracking branch 'origin/dev_ani3' into dev_cyp
# Conflicts:
#	Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs
2022-05-31 16:51:37 +08:00
ff6d61a606 修改其他的 2022-05-31 16:51:07 +08:00
2524e3a004 划船机实时保存 2022-05-31 16:47:21 +08:00
95df03e540 chart内存性能优化 2022-05-31 14:43:05 +08:00
9f0f42981e 视频路书编辑器完善 2022-05-30 15:17:55 +08:00
17c2a44e40 AR视频direction文件相关调整 2022-05-25 18:40:47 +08:00
d876c20def 对战房间下载逻辑完善 2022-05-13 11:10:37 +08:00
11b131b24a 对战AR 2022-05-13 09:28:58 +08:00
be687d6b77 适配v1表头,性能优化一波 2022-05-11 17:11:48 +08:00
509c309252 对战初步完成 2022-05-10 19:24:07 +08:00
edc629ed75 5.9修改暂存 2022-05-10 18:43:41 +08:00
b0c0890ca3 对战loading页相关逻辑 2022-04-29 19:03:18 +08:00
cfa1cc4f7b 4.29计算逻辑修改 2022-04-29 18:39:41 +08:00
3c4ecf3e83 曲线调整 2022-04-29 08:58:42 +08:00
06582201fa 加入房间,踢人,准备等tcp命令 2022-04-28 18:01:51 +08:00
f47f5c9ff6 0426动画等修改 2022-04-27 14:48:06 +08:00
de8dd933e8 创建房间 2022-04-24 18:53:29 +08:00
597929cd32 对战界面&3d模型 2022-04-22 18:24:56 +08:00
affc775226 调整后提交 2022-04-20 18:22:54 +08:00
4665feab7c 新版首页 2022-04-20 18:19:42 +08:00
4a3542010f tcp发送增加ar视频播放帧数&首页布局还原到初版 2022-04-20 17:32:27 +08:00
3532978762 AR骑行loading页面&附近的人距离延迟问题 2022-04-19 18:47:26 +08:00
8150b99411 调整多人开始骑行状态&动画控制&AR loading页面 2022-04-18 19:13:16 +08:00
995aef63f8 AR骑行动画&换装基本交互逻辑 2022-04-15 18:14:55 +08:00
a2de06fede Merge branch 'dev_ani2' into dev_ani3
# Conflicts:
#	Assets/Scripts/UI/Prefab/Rower/RowerMultiModeScript.cs
2022-04-15 17:13:55 +08:00
2f9dd43e07 1s 2022-04-15 17:13:34 +08:00
c8076494fb 3s 2022-04-15 11:14:27 +08:00
41240b1398 动画修改一波 2022-04-15 11:14:22 +08:00
f383c54507 4.14修改,设备连接去掉ftms骑行台 2022-04-14 19:18:44 +08:00
29e7219c21 位移动画 2022-04-13 18:08:55 +08:00
d44638354d 4.13修改细节,位移动画前暂存 2022-04-13 15:44:02 +08:00
874dec5ec6 新版本动画:上下滑动切换有箭头 2022-04-12 19:08:58 +08:00
7780dc5ee5 3d翻转 2022-04-11 11:40:02 +08:00
95ab695632 之前动画加上排名变化 2022-04-07 14:19:58 +08:00
92d0579060 中文版 2022-04-07 09:23:44 +08:00
d938a0c8be 多人动画位移计算和动画帧数偏差公式调整 2022-04-06 19:27:45 +08:00
efdc95ed3d 人物动画调整&UI界面细节调整 2022-04-02 18:26:18 +08:00
0a4925bb39 修改bug 2022-04-02 18:15:09 +08:00
cd1d67d9e8 动画调整&新版设计稿调整 2022-04-01 18:41:31 +08:00
30e09c9c7a 修改细节,修复bug 2022-04-01 18:07:16 +08:00
ec9337b446 观察者模式调整 2022-03-31 18:40:19 +08:00
69d73c26cd 新版设计稿 2022-03-30 18:41:06 +08:00
06aefb93c4 适配C2划船机课程和menu 2022-03-30 18:25:51 +08:00
6ec4c0101b 透明小地图&列表点击切换&海拔图头像位移 2022-03-29 18:41:32 +08:00
e0649f7ea1 修改新设计稿,保存每次划船的影子id;修改细节,增加c2适配前暂存 2022-03-29 18:12:21 +08:00
ab653b994f 适配c2;新版设计稿;对战切换手势;主逻辑接通;使用think的阻力值,修改影子模式船位置 2022-03-25 18:02:34 +08:00
bf48989a9c ui调整 2022-03-25 09:57:30 +08:00
57940568c9 初版ui提交 2022-03-24 09:36:59 +08:00
b3b882c51e 碰撞检测,射线检测,动态位移 2022-03-11 18:11:56 +08:00
16e416332d AR多人骑行研究 2022-03-10 18:32:53 +08:00
e6f3e2ecfa Merge branch 'dev_rower' into dev_cyp
# Conflicts:
#	ProjectSettings/ProjectSettings.asset
2022-03-09 09:12:42 +08:00
e3f5280d94 暂存 2022-03-09 09:11:53 +08:00
448b6d7798 微调 2022-03-04 18:29:37 +08:00
e85d5f8613 AR初版demo 2022-03-04 16:12:15 +08:00
c3514df331 请求公开线路;增加移动版 2022-03-03 15:06:13 +08:00
01df299251 邮件功能完成 2022-03-02 17:54:06 +08:00
b039388a59 改为线上 2022-02-25 09:31:17 +08:00
0c42fbe2cd Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-02-24 14:48:50 +08:00
7e67184248 不给功率;修改比赛卡片有海拔图的异常问题 2022-02-24 11:35:26 +08:00
c1c93c2a60 loading页面优化 2022-02-24 11:33:24 +08:00
353c19662c Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-02-24 08:58:14 +08:00
3b0ffd78e7 分享文案 2022-02-24 08:58:03 +08:00
ed9dc53093 loading60%问题,只要加载到第一个瓦片的高度就可以直接骑行 2022-02-23 18:14:31 +08:00
6a0bd67a6e Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2022-02-23 11:31:23 +08:00
1e350fbb4d 更改为测试服务器,广告队列判空 2022-02-23 11:29:41 +08:00
768f8261da 英文版本,pc分享功能,移动端fb分享,修改细节 2022-02-22 18:11:26 +08:00
0c1c2ed382 保存优化&本地记录自动上传 2022-02-21 16:16:35 +08:00
2c7d02ec9a 修改细节,开始搞pc 2022-02-18 18:12:31 +08:00
f5294b0d39 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/App.cs
2022-02-18 15:49:54 +08:00
365fab22d4 修改细节 2022-02-18 15:48:23 +08:00
1b3743a135 修改活动逻辑;增加一些接口;可弹多个广告 2022-02-17 16:56:18 +08:00
1148e29379 活动暂存 2022-02-16 18:22:27 +08:00
7c1d1e797c 开放划船机,增加阻力设置 2022-02-11 17:38:23 +08:00
e231d3540e 活动暂存 2022-02-11 17:26:36 +08:00
5f0efe3995 修复ios蓝牙关闭功率不变的问题 2022-02-11 17:00:28 +08:00
17aee7a740 修改bug 2022-02-11 13:46:38 +08:00
c12df53c18 ios快捷登录 2022-01-27 16:54:20 +08:00
a625db3ebe 短通知bug;安卓更新中文补全 2022-01-26 17:25:07 +08:00
7476af7701 手机端直接隐藏通知;安卓64位 2022-01-26 13:48:11 +08:00
c4bcb36356 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-26 10:53:46 +08:00
5edd784080 消息通知逻辑 2022-01-26 10:53:11 +08:00
0644421279 loading页国旗默认白色图片 2022-01-26 10:24:47 +08:00
28487b295b 进入比赛默认3d 2022-01-25 18:48:37 +08:00
2abb2d81a2 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-25 18:29:27 +08:00
1271e8e5d9 设置通知默认不显示 2022-01-25 18:29:22 +08:00
f16883465f 观察者切换人物大小问题 2022-01-25 18:25:40 +08:00
3da12c3054 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-25 17:17:17 +08:00
0a9adb19e6 修改动画;漏掉的汉化;上传图标 2022-01-25 17:15:05 +08:00
d4fbeeefc2 赛事默认3d地图&观察者人物动画bug修复&重新连接根据用户id筛选 2022-01-25 17:14:19 +08:00
37873427e3 PC点击区域&PFbutton微调 2022-01-25 11:17:42 +08:00
5340d3d58b Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2022-01-25 09:28:20 +08:00
cd162f3325 长通知和切换场景保留消息 2022-01-24 15:41:04 +08:00
9d48c05ef0 赛事默认3d视角&loading页面国旗问题 2022-01-24 11:39:48 +08:00
7bb5bafbd2 ios端google;修改ios打包时pod数据源为清华 2022-01-20 16:30:58 +08:00
58a8233697 google 登录暂存 2022-01-19 13:42:12 +08:00
45b3ee5bbc 工具栏问题修改,中文 2022-01-13 22:56:47 +08:00
0458a23c20 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-13 20:00:09 +08:00
2bf534775f dotween允许回调 2022-01-13 20:00:04 +08:00
8f022e83a6 赛事人物微调 2022-01-13 19:57:49 +08:00
fed54ad85b Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-13 18:58:01 +08:00
5bc1bec425 赛事loading和退出弹窗调整 2022-01-13 18:57:30 +08:00
5489fa2a24 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-13 18:50:55 +08:00
d89deba02c 修改bug 2022-01-13 18:50:51 +08:00
8a2d4f7b85 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2022-01-13 17:13:08 +08:00
d33e130eca 退出窗口层级微调 2022-01-13 17:11:04 +08:00
0a1ba5fbde Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-13 16:53:05 +08:00
e82592722f 首页弹消息bug;隐藏google 2022-01-13 16:53:01 +08:00
e70a84db98 骑行退出面板层级调整至modalpanel 2022-01-13 16:48:37 +08:00
697818bae4 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-13 15:36:20 +08:00
4d5523e2ff fb分享;比赛页面箭头去了 2022-01-13 15:35:57 +08:00
79ad622026 赛事loading页面条调整 2022-01-13 14:50:23 +08:00
dd1d26e9c8 pc赛事loading隐藏 2022-01-13 13:43:09 +08:00
7a7c1ee55c google处理 2022-01-13 13:16:45 +08:00
bc5e4d14e4 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2022-01-13 13:13:28 +08:00
2fec28e7cd 打包改为移动端 2022-01-13 13:13:24 +08:00
77414ad387 骑行结果移动端增加dnf和新记录的标识 2022-01-13 10:46:59 +08:00
10ffd8160a Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-13 08:57:48 +08:00
dc4cf87bc4 在线人海拔图位置超出边界隐藏 2022-01-12 18:27:00 +08:00
c53fbffe55 增加第三方信息绑定,修改细节 2022-01-12 18:16:17 +08:00
02111a57b1 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts:
#	Assets/Resources/UI/language.json
2022-01-12 16:56:50 +08:00
91fa3cc82d pc版首页;安卓google登录;解决fb登录ios问题 2022-01-12 16:55:57 +08:00
61fefda590 微调 2022-01-12 16:45:13 +08:00
f7450f0067 骑行视角增加至5级&保存逻辑增加100m不可以保存 2022-01-12 16:41:52 +08:00
f0df68bbda banner bug;maxranking修改 2022-01-12 10:29:10 +08:00
f949c531a6 我的排名微调 2022-01-11 19:08:34 +08:00
939774bd42 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-11 18:00:53 +08:00
9aecb4ce2a 移动端兼容问题 2022-01-11 16:30:36 +08:00
623cad18b2 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-11 16:21:45 +08:00
5672898ce4 工具栏修改 2022-01-11 16:21:13 +08:00
90be662db1 loading页&骑行页面记忆跳转 2022-01-11 16:19:18 +08:00
05e3d2f887 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-11 13:51:13 +08:00
e20ddb9bc1 修改细节 2022-01-11 13:51:05 +08:00
bdfe1f6ee7 结果页调整 2022-01-11 13:48:06 +08:00
27ea20b1c8 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-11 11:18:18 +08:00
5bf7635f1e pc修改 2022-01-11 11:18:09 +08:00
dbabaae032 结果页&loading页修改 2022-01-10 18:26:30 +08:00
d811eb8514 pc暂存 2022-01-10 14:59:06 +08:00
f070f5a36c 修改maplist;苹果处理 2022-01-10 10:28:03 +08:00
7431228d2f 0107修改 2022-01-07 22:46:35 +08:00
e5067228b2 发布版本 2022-01-07 20:43:14 +08:00
e87429d528 修改细节 2022-01-07 18:22:22 +08:00
79849bd537 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-07 15:11:44 +08:00
9fb819b6fe banner种类增加;集合详情增加作者;排行榜轮换功能 2022-01-07 15:11:40 +08:00
082b45c43c 实时保存微调 2022-01-07 14:33:31 +08:00
fa0d9e973c Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2022-01-07 11:05:43 +08:00
f5385e31d6 修改nav;增加消息弹窗 2022-01-07 11:05:32 +08:00
300c61a883 推荐banner增加赛事 2022-01-07 11:03:49 +08:00
16a89b07b8 推荐api&骑行结果日期格式已经跳转到记录 2022-01-07 10:34:16 +08:00
14e9e8e23b Merge remote-tracking branch 'origin/dev_cyp' into dev_nonearth
# Conflicts:
#	Assets/Scripts/Scenes/MainController.cs
2022-01-06 18:03:12 +08:00
43dc844998 loading页面Tips调整&骑行卡顿问题解决 2022-01-06 18:01:48 +08:00
2d38b63c91 暂存 2022-01-06 17:51:17 +08:00
0628bd3716 loading调整&骑行动画&角度手势方向调整 2022-01-06 10:58:52 +08:00
ba36014712 微调 2022-01-05 14:02:51 +08:00
537ae2d6ed banner手势滑动,点击效果;自动滚动 2022-01-05 09:24:06 +08:00
7f7318fb36 消息轮播bug修改;内容滚动匀速播放;收藏图标变大 2021-12-31 11:23:16 +08:00
333c99fb46 一波小改动 2021-12-30 16:51:04 +08:00
c5500c269f Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-29 20:31:34 +08:00
8a469c3a74 view all404问题 2021-12-29 19:57:24 +08:00
914e2719c1 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-29 19:48:23 +08:00
0fe5b3a953 微信分享问题解决 2021-12-29 19:48:15 +08:00
088ab9a2b8 比赛分享标题&tcp微调 2021-12-29 19:06:00 +08:00
816742898f Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-29 17:40:45 +08:00
6055b2010b 分享问题修复 2021-12-29 17:39:55 +08:00
eab147c263 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-29 17:22:51 +08:00
0e16fec75a 图片模糊功能bug修改 2021-12-29 17:17:15 +08:00
eece0cffa5 Merge remote-tracking branch 'origin/dev_cyp' into dev_nonearth
# Conflicts:
#	Assets/Resources/UI/language.json
2021-12-29 17:07:34 +08:00
95d845ac0f Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-29 17:06:04 +08:00
8dde7520ad 修改细节 2021-12-29 17:05:58 +08:00
d4fa2bbb69 骑行保存数据改成同步 2021-12-29 17:05:07 +08:00
f3f17c1256 loading页面微调 2021-12-29 15:31:01 +08:00
be731c471b Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-29 14:51:27 +08:00
7661a4e61d 全局缓存线路列表 2021-12-29 14:50:57 +08:00
0ab425cb52 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts:
#	Assets/Resources/UI/language.json
2021-12-29 14:49:07 +08:00
b8a3a30629 骑行loading&赛事计时板调整 2021-12-29 14:40:58 +08:00
bac3334a01 修改细节 2021-12-29 14:23:37 +08:00
b3f6bb6861 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts:
#	Assets/Scripts/Scenes/Ride/Scripts/ResultPanelScript.cs
2021-12-28 18:26:56 +08:00
3ca297ee96 按设计稿修改登录页登录样式;修改主页动画顺序;增加我的收藏列表可切换 2021-12-28 18:25:48 +08:00
0500736fff 最近骑行继续骑数据源 2021-12-28 14:13:38 +08:00
f23fc4b4c0 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts:
#	Assets/Scenes/Login-Mobile.unity
#	Assets/Scripts/UI/Prefab/Panel/NewRouteDetailController.cs
2021-12-28 11:26:34 +08:00
8e0ce907d0 分享调整 2021-12-28 11:25:35 +08:00
2b390717c2 暂存 2021-12-28 11:25:09 +08:00
ffc98f1a58 骑行和赛事分享&集合正在骑行的人数 2021-12-27 18:29:23 +08:00
a2b44262f7 合计修正版本暂存 2021-12-27 09:39:07 +08:00
2743c8d185 骑行界面优化&PCtips显示调整 2021-12-24 18:33:58 +08:00
769b75e2e2 FB登录功能暂存;苹果有问题 2021-12-24 13:58:14 +08:00
6423007638 Facebook sdk接入 2021-12-23 15:36:11 +08:00
4260cf05d3 移动端浏览器 2021-12-23 09:54:14 +08:00
d91dc17ea7 单击手势进入极简模式 2021-12-22 16:20:27 +08:00
67abc1ef63 loading页面不显示loading序列帧 2021-12-22 16:06:35 +08:00
fc55360be0 骑行视角手势&移除按钮音效 2021-12-22 14:25:57 +08:00
c8c27bd021 3d骑行视角旋转 2021-12-21 18:43:22 +08:00
5c2c22b675 收藏问题;苹果登录无法快速登录问题 2021-12-21 17:41:17 +08:00
4b3dad0b84 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts:
#	Assets/Scripts/Scenes/MainController.cs
2021-12-21 10:47:00 +08:00
939084b074 解决消息处理bug 2021-12-21 10:10:05 +08:00
05d2c74efa 苹果登录暂存 2021-12-21 09:58:07 +08:00
348552b0bc 消息通知增加上线了 2021-12-20 14:44:48 +08:00
ebcc83ed6a Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-17 13:03:27 +08:00
a9e4b1fd34 安卓分享 2021-12-17 13:03:19 +08:00
2c8457c75e 中断骑行弹窗bug修复 2021-12-17 11:24:24 +08:00
7616e09a40 骑行loading页面bug修复&线路集合图片异步加载 2021-12-17 11:10:17 +08:00
6c0d9f5dec Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-16 18:43:34 +08:00
32777c739d 首页动画不停止bug;中文图片绑定 2021-12-16 18:43:26 +08:00
77989384fc 音效微调 2021-12-16 18:27:50 +08:00
12e0d8d295 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp
# Conflicts:
#	Assets/Scripts/UI/Prefab/MapList/MapItem.cs
2021-12-16 16:55:14 +08:00
1cb555c13d 移动端消息 2021-12-16 16:54:35 +08:00
b9d14a590c 音效&骑行loading优化 2021-12-16 16:53:38 +08:00
24044ec772 跳上传线路网页;pc分两种消息弹窗 2021-12-16 16:00:14 +08:00
603efc7508 三层消息通知,修改细节 2021-12-15 18:18:12 +08:00
9231304269 Merge branch 'dev_nonearth' into dev_cyp 2021-12-15 13:32:38 +08:00
40ac7e1397 消息通知 2021-12-15 13:24:26 +08:00
98de46f8b1 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-15 13:03:32 +08:00
6ed3895fcd 加入合集后的跳转问题 2021-12-15 11:08:25 +08:00
ec4a28cd2a 集合首页和详情页 2021-12-14 18:10:58 +08:00
3da24b200d Merge remote-tracking branch 'origin/dev_cyp' into dev_nonearth
# Conflicts:
#	Assets/Resources/UI/Prefab/Ride/Mobile/Panel.prefab
2021-12-14 16:24:09 +08:00
16b42a19e4 ios端本地化 2021-12-13 17:18:57 +08:00
625e2b7934 app名称本地化自适应;分享图片接入 2021-12-10 18:10:20 +08:00
cbd1ce3313 集合功能部分 2021-12-10 09:53:49 +08:00
7d2af849f4 骑行视角等优化 2021-12-09 18:17:39 +08:00
b1fedd4831 骑行细节优化(视角缩放,海拔图拉伸) 2021-12-08 18:10:38 +08:00
083b414be0 点击附近的人不隐藏面板 2021-12-07 17:43:32 +08:00
de4292d55a 骑行记录实时保存,异常中断重新连接 2021-12-07 16:44:36 +08:00
542036fb45 Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp 2021-12-07 14:37:13 +08:00
fa144dbaa0 新页面框架(PC) 2021-12-07 14:37:08 +08:00
cc6730cbc4 汉化微调&赛事相关中文版本样式调整 2021-12-06 17:02:30 +08:00
aff636f9a8 Merge remote-tracking branch 'origin/dev_cyp' into dev_nonearth 2021-12-03 18:22:31 +08:00
ef3e3a8321 高版本反而弹更新的bug;部分手机自动更新由于程序退出导致安装包损坏问题 2021-12-03 18:21:17 +08:00
5d8be079c2 汉化微调 2021-12-03 18:19:24 +08:00
aa0c8d4fb6 中文绑定一波 2021-11-25 17:31:26 +08:00
134dc76ec5 Merge branch 'dev_language' into dev_release
# Conflicts:
#	Assets/Resources/UI/Prefab/Panel/Mobile/MapListPanel.prefab
#	Assets/Resources/UI/Prefab/Panel/Mobile/RaceListPanel.prefab
2021-11-25 10:04:35 +08:00
9ff3de1d10 Merge branch 'dev_cyp' into dev_release 2021-11-25 10:03:35 +08:00
a2ff7604cc 解决海图索引超过2000头像不显示问题 2021-11-24 16:40:53 +08:00
70a8bc0000 Merge remote-tracking branch 'origin/dev_release' into dev_release 2021-11-24 13:10:10 +08:00
06b102f0eb 比赛海拔图位置&赛事无法开始问题 2021-11-24 13:08:42 +08:00
350103d5a9 Merge remote-tracking branch 'origin/dev_release' into dev_release 2021-11-24 10:16:14 +08:00
2cf77e94ed 搜索按钮变大 2021-11-24 10:16:09 +08:00
917cbbfb90 赛事开始逻辑调整 2021-11-24 10:15:28 +08:00
eeffccd4e6 taskrun 2021-11-24 09:10:23 +08:00
0549cdbd52 赛事提醒自动保存当前骑行 2021-11-23 16:27:35 +08:00
732e5ac6c6 测试包;退出骑行场景释放tcp资源 2021-11-23 16:10:25 +08:00
c0ebe80a1f 网络异常处理 2021-11-23 15:58:02 +08:00
23e5ae6ebd 中文调整 2021-11-23 15:48:22 +08:00
265430053a 设备连接汉化调整 2021-11-23 09:58:55 +08:00
190a66bb68 Merge branch 'dev_lishuo' into dev_cyp
# Conflicts:
#	Assets/Resources/UI/Prefab/Panel/Mobile/DevicePanel.prefab
#	Assets/Scenes/Login-Mobile.unity
#	Assets/Scenes/Login.unity
#	Assets/Scripts/App.cs
#	Assets/Scripts/Editor.meta
#	Assets/Scripts/Scenes/Ride/Scripts/CyclingController.cs
2021-11-23 09:51:10 +08:00
8c5ad08475 比赛列表搜索逻辑统一 2021-11-23 09:47:04 +08:00
6cc2486ebf Merge remote-tracking branch 'origin/ios_nearby' into dev_cyp 2021-11-23 09:34:20 +08:00
68688c9daf 超时重连增加条件编译 2021-11-23 09:33:05 +08:00
d5ea26f15c ios附近的人掉线问题 2021-11-22 18:04:16 +08:00
37e4c54c20 修改观察者模式提示连接设备bug;新版本设备连接bug;单开限定 2021-11-22 16:10:11 +08:00
9570334e25 压缩图片bug解决 2021-11-22 09:51:17 +08:00
3083224ee6 保存图片压缩;记录列表清缓存;ms延迟3s;比赛列表样式问题 2021-11-19 10:54:14 +08:00
5ba176725f 单点登录不在进程内运行问题;gps取定位服务的;点击图标显示毫秒 2021-11-18 14:45:31 +08:00
42e23e2f84 使用astc优化网络图片;workouts链接修改 2021-11-18 09:15:19 +08:00
5480de5c6d 测试 2021-11-16 20:19:32 +08:00
e3e2f5200b Merge remote-tracking branch 'origin/dev_memory' into dev_cyp 2021-11-16 18:41:22 +08:00
6a4390f1b9 两个列表进骑行释放内存 2021-11-16 18:41:18 +08:00
a73e125a49 骑行优化 2021-11-16 18:03:56 +08:00
3295314b7e Merge remote-tracking branch 'origin/dev_memory' into dev_cyp 2021-11-15 15:21:46 +08:00
8b3dd7a40a 骑行内存优化&设备连接点击优化 2021-11-15 15:21:22 +08:00
b79584f745 删除appcenter;删除打包后的debug 2021-11-15 11:38:13 +08:00
402f19b8a5 Merge remote-tracking branch 'origin/dev_memory' into dev_cyp
# Conflicts:
#	Assets/Scenes/Login-Mobile.unity
#	Assets/Scenes/Login.unity
2021-11-15 11:34:49 +08:00
9acde45f4a 一些设置调整;进入骑行时请texture 2021-11-15 11:33:57 +08:00
004410048f Revert "Revert "骑行内存优化""
This reverts commit f7b29819f65de94bdb9dee69817201bd1e5829af.
2021-11-14 16:27:00 +08:00
f7b29819f6 Revert "骑行内存优化"
This reverts commit 7ebd5f59e367c8d5304ce6d5cba90d31c6b81c86.
2021-11-14 16:25:41 +08:00
7ebd5f59e3 骑行内存优化 2021-11-14 16:24:11 +08:00
e14a683f62 1478泰国时区问题 2021-11-12 16:53:45 +08:00
d754ff3b15 app center;增加發送ping的秒 2021-11-12 16:21:13 +08:00
1bd1ffdb5a 重骑传参微调 2021-11-11 17:45:02 +08:00
c50c229e30 微调 2021-11-11 17:14:05 +08:00
50b46c5b76 伴侣骑行继续骑 2021-11-11 15:55:58 +08:00
eb9338390c 多语言微调 2021-11-11 14:20:08 +08:00
51834b709c 中文版本 2021-11-10 18:13:38 +08:00
8e88b4adba 地球null问题,隐藏划船机 2021-11-09 16:47:21 +08:00
609e4dc367 延迟问题解决 2021-11-09 11:37:10 +08:00
9a545f00f4 修改细节 2021-11-08 13:07:08 +08:00
baab5a9fb0 修改细节 2021-11-03 13:48:53 +08:00
e8a12452ca Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_release 2021-11-03 09:52:51 +08:00
f92b623349 暂存 2021-11-03 09:52:03 +08:00
a9fc25defb 解决大地球收藏问题&单人骑行切换地图海拔图位置问题和地图不全 2021-11-02 14:38:05 +08:00
558fb16160 增加编号,loading页提示,延迟毫秒 2021-11-01 11:04:22 +08:00
b9aa0131cc 划船机保存前读秒 2021-10-25 16:13:04 +08:00
eb21914fb7 划船机其他细节 2021-10-22 18:18:26 +08:00
a4e17a56d0 划船机停止逻辑,切换图标 2021-10-21 18:04:33 +08:00
e503443f22 Merge branch 'dev_rower' into dev_release
# Conflicts:
#	Assets/Scenes/Login-Mobile.unity
2021-10-20 15:12:05 +08:00
3a834fca08 ios审核先屏蔽第三方登录 2021-10-20 14:58:37 +08:00
8f8ee0b833 android11跳转 2021-10-20 13:32:43 +08:00
26e4e81402 暂存 2021-10-20 10:20:12 +08:00
b075279a14 增加搜索框,ios图片名重复问题 2021-10-18 14:03:26 +08:00
f731494396 pc兼容 2021-10-15 09:54:23 +08:00
dd4157cbc2 一些设置 2021-10-15 09:29:05 +08:00
05f6c8a08b 微信注册样式问题 2021-10-14 14:04:44 +08:00
3c540dece4 修改细节 2021-10-13 19:03:22 +08:00
d8adb8a5b8 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_release 2021-10-13 11:29:14 +08:00
9be2e77ae5 设备连接页面检测定位服务 2021-10-13 11:29:09 +08:00
0560d0f278 继续骑微调 2021-10-13 10:44:17 +08:00
efd1795e63 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_release 2021-10-12 20:51:07 +08:00
4d404b9162 赛事观察者切换视角尾巴问题 2021-10-12 20:43:33 +08:00
f0314adb27 隐藏划船机 2021-10-12 20:26:41 +08:00
2f0291836e ios以及bug处理 2021-10-12 20:26:25 +08:00
d4326ffb42 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_release 2021-10-12 20:11:18 +08:00
44ff898f8d 更新弹窗 2021-10-12 20:07:13 +08:00
f3da1a5575 继续骑行隐藏右边影子选择面板 2021-10-12 15:26:58 +08:00
c19b8630cf 修改loading序列帧 2021-10-11 13:25:37 +08:00
55d7304de1 pc打包错误 2021-10-09 15:05:41 +08:00
f1ddde8a2e Merge branch 'dev_mobile' into dev_gesture 2021-10-09 10:45:56 +08:00
cad2e92fd2 编辑页面手势应用 2021-10-09 10:42:27 +08:00
4aa6178495 赛事卡片bug修正 2021-10-08 17:04:55 +08:00
fd8f419f09 手势插件引入暂存 2021-10-08 16:03:55 +08:00
6d1bc8e2c8 暂存 2021-10-08 15:22:20 +08:00
d035361718 ios端时间格式错误问题 2021-09-30 17:09:52 +08:00
6501284bbc 地球收藏问题,ios 蓝牙有返回值处理,划船机倒计时1时重置 2021-09-30 15:23:40 +08:00
9511e30e50 蓝牙问题 2021-09-30 09:06:35 +08:00
561ad993b8 调整动画和chart图标细节,重置命令 2021-09-29 14:37:43 +08:00
8d8fd59a80 修改细节 2021-09-28 20:35:16 +08:00
b74c3b57b4 倒计时;三按钮弹窗 2021-09-28 17:51:58 +08:00
85e0a13f08 增加选择页,修改记录列表pc兼容 2021-09-28 15:25:52 +08:00
8802676b98 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-28 11:31:11 +08:00
486b385c84 列表搜索调整 2021-09-28 11:30:51 +08:00
5bd1c3b1ca Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile
# Conflicts:
#	Assets/Scripts/Scenes/MainController.cs
2021-09-28 11:30:08 +08:00
c73545d912 划船机暂存 2021-09-28 11:27:24 +08:00
75900ccf3d 修复海拔图头像切换以及移动错位问题 2021-09-27 18:43:41 +08:00
65e7d9c4f4 优化赛事人数多卡的问题&解决蓝牙连接133错误码 2021-09-24 19:16:40 +08:00
1c73701e73 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-17 22:20:47 +08:00
125e9a48c6 赛事排名微调 2021-09-17 22:20:05 +08:00
9eab7c847b 苹果横屏翻转 2021-09-17 20:21:45 +08:00
f35dea5c6a Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-17 18:51:33 +08:00
18b330fa30 两个平台屏幕可转 2021-09-17 18:50:50 +08:00
211967dda2 骑行字体微调 2021-09-17 18:37:58 +08:00
edf0313155 微调 2021-09-17 18:31:00 +08:00
62e88668e0 修复影子选手隐藏后仍然可以点击问题 2021-09-17 14:18:50 +08:00
b89322c59b 合并ant速度计修改和界面微调 2021-09-17 11:37:42 +08:00
a67602b00b Merge remote-tracking branch 'origin/fit_speed_device' into dev_mobile_ble
# Conflicts:
#	Assets/Scripts/Devices/Ble/Devices/SpeedCadence.cs
2021-09-17 09:42:27 +08:00
65f2b0af0a 判断int型异常 2021-09-17 09:35:15 +08:00
40b6205abc Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-16 20:35:25 +08:00
9b0c86aefb watch按钮只读样式 2021-09-16 20:35:12 +08:00
e6e519d166 赛事提醒样式微调 2021-09-16 20:12:13 +08:00
750d9107b4 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-16 19:50:38 +08:00
26250f3e47 iphone7以下光圈去掉 2021-09-16 19:49:45 +08:00
a999bf1b72 解决大地图移动后选中线路不显示卡片 2021-09-16 19:48:56 +08:00
806116af19 修改样式 2021-09-16 17:09:40 +08:00
58fe43d59f Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-09-16 16:25:26 +08:00
27881fbb6b 切换app调整 2021-09-16 16:24:54 +08:00
8fde11f985 赛事结果页面和赛事怕排行界面微调 2021-09-16 16:21:52 +08:00
bd8089d0a9 微调 2021-09-16 15:59:08 +08:00
1b7e585027 修改包名 2021-09-16 15:36:36 +08:00
d7486c920c Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-09-15 21:16:30 +08:00
8c7a9afaa3 取消开始应用请求权限;淡入淡出ios 2021-09-15 21:11:21 +08:00
49c264ff36 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-15 20:06:35 +08:00
6640780c93 Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-09-15 19:56:38 +08:00
b5c78aba4f 解决地球不能点击滑动&蓝牙踏频增加初始轮径&骑行灵敏度设置增宽 2021-09-15 19:55:50 +08:00
7d4617eca6 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-09-15 19:30:47 +08:00
48397f3d1d 修改细节,安卓一进应用请求权限 2021-09-15 19:30:41 +08:00
ad26419654 设备连接微调 2021-09-15 14:17:11 +08:00
15015f83a8 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile
# Conflicts:
#	Assets/Scripts/App.cs
2021-09-15 10:45:53 +08:00
6fa4504e46 替换图片,push问题,ios配置,常亮 2021-09-15 10:45:11 +08:00
afb8c358f5 解决场景变慢的原因 2021-09-15 09:26:41 +08:00
0b1247249d Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-09-14 11:18:35 +08:00
7bd058004d 骑行和设备连接图标&发送tcp带上客户端版本号 2021-09-14 11:18:04 +08:00
e84f14250b 比赛卡片效果修改;useragent修改;微信错误提示 2021-09-14 11:14:51 +08:00
ae6769e24f 合并微调 2021-09-13 18:30:38 +08:00
939d6f1d0c Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble
# Conflicts:
#	Assets/Scenes/Login-Mobile.unity
2021-09-13 18:28:05 +08:00
dfb80658dd 登录增加loading&赛事提醒修改 2021-09-13 18:21:43 +08:00
969835e4d7 微信登录接入;卡片点击效果 2021-09-13 17:33:58 +08:00
51cea743be 骑行界面图标微调 2021-09-09 16:41:36 +08:00
ca51e06d37 Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-09-09 16:32:17 +08:00
ee1114e2cf 解决累计爬升不准问题&本地文件记录样式 2021-09-09 16:29:22 +08:00
f1f982b90c iosbug;android不需要导出项目;修改样式;可修改头像 2021-09-09 15:44:28 +08:00
50ad74bb09 赛事角标刷新;处理弹窗层次问题 2021-09-08 17:53:43 +08:00
5a148c28a8 赛事筛选;微信角标切口;选择图片功能权限问题
选择图片功能权限问题,需先导出项目,将res/xml文件夹复制到unitylibrary的res文件夹下
2021-09-08 10:29:20 +08:00
8a4657c11c Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-09-07 16:13:12 +08:00
b86cb01ea2 修改样式,增加图片 2021-09-07 16:12:16 +08:00
99081519bb 骑行界面&赛事界面调整&设备断开功能 2021-09-07 16:11:15 +08:00
fe65b83c89 ios选择图片功能,结果列表扩大 2021-09-07 15:26:43 +08:00
510cd11049 意见反馈增加图片 2021-09-07 11:14:42 +08:00
b11c5de681 修改样式 2021-09-06 17:50:01 +08:00
467a6f3810 Merge remote-tracking branch 'origin/dev_m1' into dev_mobile_ble
# Conflicts:
#	Assets/Scripts/App.cs
2021-09-03 15:12:01 +08:00
169b9719f6 图片改名 2021-09-03 15:10:18 +08:00
1254414415 修改细节 2021-09-03 15:03:54 +08:00
7af935118e 赛事界面&骑行界面调整 2021-09-03 13:06:26 +08:00
3fb8aee922 骑行界面细节调整 2021-09-02 11:04:50 +08:00
c280408192 Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble
# Conflicts:
#	Assets/Scripts/App.cs
#	Assets/Scripts/Mobile/WeChatController.cs
2021-09-02 10:10:06 +08:00
c5586b3eb1 单人骑行界面 2021-09-02 10:08:46 +08:00
2663068574 地球页面;反馈页面样式修改 2021-09-01 16:14:45 +08:00
3ec6fd0569 比赛;编辑页面 2021-08-31 17:11:43 +08:00
cdccd78602 设备连接界面完善 2021-08-31 16:27:36 +08:00
3a360d3437 附近的人逻辑优化&Android进入骑行提示开启定位服务问题修复 2021-08-31 14:24:08 +08:00
29aef943b9 适配速度计和踏频计 2021-08-31 09:09:49 +08:00
99540eb1fd ios蓝牙适配 2021-08-30 18:28:26 +08:00
85130ce6c3 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile
# Conflicts:
#	Assets/Scripts/Scenes/MainController.cs
2021-08-27 10:13:17 +08:00
428a7c5507 暫存 2021-08-27 10:12:50 +08:00
d8927ceca5 蓝牙停止扫描和一些bug修复 2021-08-26 19:33:43 +08:00
f21b83697b 暂存 2021-08-26 15:49:06 +08:00
723c881790 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile 2021-08-26 09:29:42 +08:00
e1a85eeb5e 结果列表页,用户页 2021-08-26 09:29:35 +08:00
0139cbc173 Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-08-25 16:09:18 +08:00
eb87fe07aa 设备连接页面调整 2021-08-25 16:07:26 +08:00
89e3a04fe9 暂存 2021-08-25 15:35:41 +08:00
92c8f246b8 Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble 2021-08-25 11:22:23 +08:00
bb08b6b762 tcp库更新&附近人下拉调整 2021-08-25 11:20:59 +08:00
88beff5b89 条件编译报错问题 2021-08-25 10:31:20 +08:00
f155b2b627 Merge remote-tracking branch 'origin/dev_mobile_ble' into dev_mobile
# Conflicts:
#	Assets/Plugins/Android/AndroidManifest.xml
#	Assets/Plugins/Android/AndroidManifest.xml.meta
#	Assets/Plugins/iOS.meta
#	Assets/Scripts/App.cs
#	Assets/Scripts/Devices/MainDeviceAdapter.cs
#	Assets/Scripts/Scenes/LoginController.cs
#	Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs
2021-08-25 10:23:51 +08:00
341195d78d 暂存 2021-08-25 10:20:33 +08:00
3de8b1d555 移动端蓝牙设备正常骑行 2021-08-24 18:34:41 +08:00
3c9d489c76 增加移动端界面暂存 2021-08-24 17:50:14 +08:00
31e8e3bebb 移动端微信接入 2021-08-24 09:28:46 +08:00
d6c3ea2007 插件文件上传 2021-08-20 19:01:24 +08:00
6fab61f97d 移动端蓝牙框架初步导入 2021-08-20 18:45:16 +08:00
f6740d31bb Merge branch 'dev_lishuo' into dev_mobile 2021-08-19 18:11:12 +08:00
81a18de9f4 蓝牙抽象成接口 2021-08-19 18:03:25 +08:00
ca91f45ef3 切换移动端暂存 2021-08-19 16:28:57 +08:00
f14a071179 修改字 2021-08-19 16:24:54 +08:00
688c12b28e Merge branch 'dev_lishuo' of https://gitlab.com/rhino4biz/powerfun/powerfun-unity into dev_lishuo 2021-08-19 14:10:11 +08:00
f39500c560 附近的人删除逻辑 2021-08-19 14:09:42 +08:00
34a2c0bbb2 稍微逻辑修改 2021-08-19 13:23:22 +08:00
dd669d74f5 线路列表排序增加near下拉项 2021-08-19 11:24:57 +08:00
a6f673f805 设备连接速度踏频计title和logo显示问题 2021-08-18 10:46:00 +08:00
49da1493d5 nearby重合问题&线路排序修改&显示赛事编号 2021-08-17 18:43:41 +08:00
35b5ab59d3 切换移动端暂存 2021-08-13 17:19:02 +08:00
11e9acdb14 修复单人骑行ridingtime差一秒 2021-08-12 18:57:30 +08:00
906dc7dec8 闪动问题 2021-08-12 16:29:00 +08:00
3902865658 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2021-08-12 13:24:38 +08:00
32b6e28736 修复右边排名问题 2021-08-12 13:24:00 +08:00
25dcf0fde3 序列帧缺失问题 2021-08-12 11:22:37 +08:00
c91bf7ae2f Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-08-12 10:04:28 +08:00
a9530096e4 tcp逻辑微调 2021-08-12 10:04:01 +08:00
bb8a0712b7 处理空广告页情况 2021-08-12 10:03:29 +08:00
570bd1554f 微调 2021-08-11 16:56:17 +08:00
3fcc6c0489 人物动画调整&网页url移除#号&riding time 差一秒的问题 2021-08-11 10:30:23 +08:00
c717b93169 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-08-10 16:36:33 +08:00
5642d3f1c9 赛事微调&mapbox sqlite dll 更新 2021-08-10 16:36:13 +08:00
81a7af517a 修改台湾旗帜 2021-08-10 09:41:14 +08:00
40bb16a132 修改all race跳到顶上的bug 2021-08-09 17:11:14 +08:00
7a1042d184 修改细节 2021-08-09 16:32:47 +08:00
9f19e951cc Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-30 20:45:51 +08:00
317f7c6d8c cookie bug 2021-07-30 20:44:45 +08:00
8b5070214e Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-30 20:40:30 +08:00
fe2c0280dc cookiebug修改 2021-07-30 20:39:23 +08:00
b8a5982bc5 微调 2021-07-30 19:39:01 +08:00
da4fed58b0 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-30 18:08:49 +08:00
ea70e04ec0 提高骑行时间精准度和一些细节调整 2021-07-30 18:08:31 +08:00
be677e766d 切換背景圖 2021-07-30 17:42:41 +08:00
07a7a95aa8 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-30 15:39:59 +08:00
074200cb4f 倒计时的算法及界面调整 2021-07-30 15:38:40 +08:00
b4e97d5514 Race按钮恢复原样,增加是否创建比赛 2021-07-30 15:38:14 +08:00
bea0e40ec1 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-30 09:54:06 +08:00
12838266ba 骑行结束时间误差问题解决 2021-07-30 09:53:49 +08:00
44c1b771f7 status=0情况 2021-07-29 21:15:26 +08:00
3c6edc624b 修改結束狀態按钮 2021-07-29 20:58:48 +08:00
1919370a23 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-29 20:01:52 +08:00
9ab8165630 消息通知bug&赛事界面调整 2021-07-29 20:01:38 +08:00
7884e7ac7e 修改细节 2021-07-29 19:55:29 +08:00
50fd9c3af6 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-29 16:13:39 +08:00
33df128750 修复小人移动动画显示异常和一些界面调整 2021-07-29 16:13:23 +08:00
edce9c676d 修改细节 2021-07-29 15:45:44 +08:00
6ab3ee19f2 修改细节 2021-07-29 13:55:33 +08:00
b9db3325a8 微调 2021-07-29 09:26:19 +08:00
b8ffdcbffe Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-28 21:12:06 +08:00
09f72d10bd 英文文案调整 2021-07-28 21:11:46 +08:00
5c96b10385 下载速度,修改文案 2021-07-28 21:09:48 +08:00
7d0a4fbd97 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-28 18:56:37 +08:00
c96cdbb163 英文文案调整 2021-07-28 18:56:23 +08:00
abf913b467 修改细节 2021-07-28 18:41:40 +08:00
978debcd23 修复比赛结束时观察者模式看不到结果&观察者不用连接设备 2021-07-28 16:30:07 +08:00
4a8239a2db Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/Apis/Models/MapCompetition.cs
2021-07-28 15:01:40 +08:00
952e5038ed 修改细节 2021-07-28 14:59:21 +08:00
3307d96ff3 修复重现时间没有转换成本地时间的bug 2021-07-28 14:57:11 +08:00
ea717ccdb8 海拔图小头像&比赛状态实时刷新 2021-07-28 14:00:03 +08:00
e29f0a8116 比赛进行中前后面板微调,修复比赛一直处于开始状态的bug 2021-07-27 20:35:23 +08:00
cfcb302a31 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-27 19:34:44 +08:00
0eb399be9a 赛事loading页面状态实时变化和一些微调 2021-07-27 19:34:33 +08:00
ca938ab6f5 修改细节 2021-07-27 18:36:49 +08:00
ea79b6cfc5 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-27 13:29:55 +08:00
c9b5520331 赛事loading页面按钮可用性调整 2021-07-27 13:29:41 +08:00
164db7c013 修改卡片样式 2021-07-27 13:28:00 +08:00
d4ae01cd32 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-27 09:18:49 +08:00
17f2b1cedd 赛事消息通知面板和界面微调 2021-07-27 09:18:34 +08:00
ab9b6a86f3 样式调整 2021-07-26 19:50:10 +08:00
7d0128d912 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/UI/Prefab/Race/RaceButtonGroupScript.cs
2021-07-26 14:11:10 +08:00
1f3485846f 细节调整 2021-07-26 14:09:21 +08:00
929fb0a1a7 修改细节 2021-07-26 14:08:43 +08:00
ac59808915 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/Apis/Models/MapCompetition.cs
#	Assets/Scripts/UI/Prefab/Race/RaceButtonGroupScript.cs
2021-07-23 18:11:58 +08:00
7f8ac10d47 合并后微调,增加赛事提醒功能 2021-07-23 18:07:12 +08:00
b93fbd2f2e 加链接,文件位置 2021-07-23 17:59:38 +08:00
ae3f9d2101 一些细节修改 2021-07-23 15:04:46 +08:00
21529db9dc Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-07-23 10:18:23 +08:00
1c2afb4125 增加一些图片,enter数据源 2021-07-23 10:02:09 +08:00
d18ff09002 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/Apis/Models/MapCompetition.cs
2021-07-23 09:43:46 +08:00
d9d66ab96c 赛事首页和列表 2021-07-23 09:41:20 +08:00
e76b5c443f 赛事功能完善
创建比赛按钮;loading页面more按钮等
2021-07-23 09:04:56 +08:00
eed2d13624 loading页&结果页面&代码结构微调 2021-07-16 18:37:02 +08:00
eb1803c9ef 赛事逻辑细节调整 2021-07-09 18:16:50 +08:00
b2a527f518 观察者TCP通信对接,实时列表优化,观察者模式界面显示逻辑 2021-07-06 18:24:15 +08:00
d6a7cd798f tcp逻辑调整,历史逻辑增加赛事相关派生类 2021-07-01 18:41:35 +08:00
ec45246aa4 骑行代码迁移,赛事逻辑初步框架完成 2021-06-29 18:03:20 +08:00
380e67cc1e 完成比赛相关接口&历史代码整合 2021-06-24 18:19:28 +08:00
58ec860669 结果页面日期格式修正 2021-06-22 17:46:07 +08:00
858b76d4d2 解决utc时间问题 2021-06-22 13:50:08 +08:00
2f8318b24e Revert "修复其骑行记录详情URL错误"
This reverts commit 23d049d176ba581562a5e8c3b7719b043d9afd95.
2021-06-22 10:04:08 +08:00
23d049d176 修复其骑行记录详情URL错误 2021-06-22 09:56:28 +08:00
6ad01c50df 路书上在线的人过滤掉比赛中的用户,获取服务器UTC时间转换成当地时间 2021-06-18 18:26:25 +08:00
dcc65cdd86 骑行记录详细页面跳转附加token 2021-06-16 18:12:58 +08:00
3f718f1490 地球列表下拉动作修改 2021-06-11 10:57:04 +08:00
ebe3dc11e6 解决设备页标题显示错误的问题 2021-06-10 19:11:14 +08:00
8dfd4d696c 骑行页面增加错误诊断,解决视角切换箭头位置回到起点问题 2021-06-10 18:14:14 +08:00
734893ff83 支持蓝牙可用状态变更。搜索不到设备自动停止当前线程。 2021-06-10 17:46:43 +08:00
dd474f1f61 Merge remote-tracking branch 'origin/dev_lishuo' into dev 2021-06-09 19:56:26 +08:00
936d325cf9 解决法语修改个人体重小数点不报错以及首页卡路里为0 2021-06-09 19:44:06 +08:00
5f7cc43593 解决蓝牙设备丢失以后状态不变的问题 2021-06-09 18:16:35 +08:00
15e440715d 年月日改成日月年 2021-06-09 17:29:38 +08:00
abd35810bc 附近的人区域处理,骑行结果页面标题大小写问题 2021-06-09 17:17:11 +08:00
5ec6f4caca Merge remote-tracking branch 'origin/dev' into dev_lishuo 2021-06-09 15:22:52 +08:00
25c866d090 修改连接设备界面;修改大地图在panel上缩放大地图也缩放的问题 2021-06-09 11:27:11 +08:00
4064d4294a 解决切换视角地图高度变化的问题 2021-06-08 17:39:51 +08:00
541aefe4dd 蓝牙监听调整 2021-06-08 16:28:00 +08:00
1020632757 Merge remote-tracking branch 'origin/dev_lishuo' into dev 2021-06-08 13:07:48 +08:00
35b50efded 用户信息与路书列表地图背景区域化处理 2021-06-08 11:32:06 +08:00
aa75bb281f 解决蓝牙卡顿问题 2021-06-08 10:30:26 +08:00
b6d70e6856 解决金额区域差异问题 2021-06-07 17:05:49 +08:00
432e02e3de 调整微信登录 2021-06-07 14:48:09 +08:00
17eaccb72e 蓝牙调用调整 2021-06-04 19:23:32 +08:00
5671b35dce 修复设备选择界面多设备选择bug 2021-06-04 18:28:11 +08:00
7729332f41 接入基本设备 2021-06-04 13:22:59 +08:00
2f84f70a5f 接入蓝牙基本结构 2021-06-04 13:22:59 +08:00
84e8b50bbf Merge branch 'dev_lishuo' into dev 2021-06-04 13:21:23 +08:00
8e1b4bbbca 解决区域标点符号问题 2021-06-04 13:19:37 +08:00
e88f32e99b 搜索面板条件关闭重新打开重置 2021-05-26 18:04:58 +08:00
4e4da38252 伴侣骑行不选人点击确定报错bug修复;3d视角调整;倒计时优化; 2021-05-25 18:13:59 +08:00
3757ae6e6c 继续骑行海图初始位置,地图属性调整 2021-05-24 10:16:35 +08:00
a2a6ee1f49 限制昵称长度 2021-05-20 21:03:48 +08:00
724e43f392 附近的人自己的名称长度调整 2021-05-20 20:47:53 +08:00
5599d6dcc8 限制编辑信息里的长度 2021-05-20 20:07:45 +08:00
509a7c16bd Merge branch 'dev_cyp' into dev 2021-05-20 20:01:55 +08:00
7eb76291ec Merge branch 'dev_lishuo' into dev 2021-05-20 20:00:59 +08:00
0517382612 修改bug 2021-05-20 20:00:33 +08:00
fdf33ba8df 海拔图头像位移bug修复 2021-05-20 19:56:17 +08:00
2d36d5df39 配置连接串为线上 2021-05-20 18:05:55 +08:00
5db375bcf5 解决台湾无法点击的问题 2021-05-20 16:15:53 +08:00
3e38fd65c2 Merge branch 'dev_lishuo' into dev 2021-05-20 16:04:54 +08:00
7ba012f5f2 界面微调,设备连接中断跳时间bug修复 2021-05-20 15:55:27 +08:00
09514e2a8a 下载界面增加开始按钮,登陆注册bug修改 2021-05-20 14:12:43 +08:00
f1eeb11543 本地记录重新上传,一些界面bug修复 2021-05-19 18:39:47 +08:00
470d52b1bc 人物动画调整 2021-05-14 19:26:15 +08:00
eb70ee4397 细节调整
线路材质&位置调整,海拔图区间优化,loading动画只执行一次问题解决,小地图的球替换成圆形图片
2021-05-14 16:11:22 +08:00
e29381b13b 加载页进度bug修复 2021-05-14 09:26:33 +08:00
46cc231fe7 海拔图区间微调,消息面板&线路等微调 2021-05-13 17:48:28 +08:00
b694a69f16 微调 2021-05-12 18:52:14 +08:00
87d581291b 在线用户和影子选手信息面板,小地图已经骑行路线 2021-05-12 18:51:03 +08:00
53ec9c60ac 小调整 2021-05-12 10:42:26 +08:00
a7ea02f70a Merge branch 'dev_lishuo' into dev
# Conflicts:
#	.gitignore
#	Assets/Scenes/Ride/Scripts/SelectPlayerFactory.cs
2021-05-12 10:30:08 +08:00
8f0598580d 骑行页面消息通知
在线用户和影子选手用图片显示,缩放等功能按钮微调
2021-05-11 18:21:32 +08:00
2c5501a096 更新页面,目前是强制更新 2021-05-11 10:47:04 +08:00
2b4b2c4f70 小地图进度微调,人物脚本调整 2021-05-10 18:13:27 +08:00
8ca32cd1ae 显示当前路线在线的人 2021-05-08 18:36:59 +08:00
6645310601 更新拉取图片的缓存代码 2021-05-08 14:38:23 +08:00
696fd256a8 登录bug&影子选手bug修复 2021-05-08 14:27:56 +08:00
92676d7cf8 Merge branch 'dev_cyp' into dev
# Conflicts:
#	Assets/Scripts/App.cs
#	Assets/Scripts/UIManager.cs
2021-05-08 11:15:28 +08:00
9a4e646a8f 修复台湾问题;加服务器时间; 2021-05-08 11:09:03 +08:00
d4339968f6 场景名改掉 2021-05-08 11:07:55 +08:00
584cba79ae 小地图分辨率微调,影子选手包含自己 2021-05-08 11:02:11 +08:00
60bf5bd59d 增加confirm类型;国家省份城市json;增加列表缓存 2021-05-08 10:52:37 +08:00
e4d4333357 视角切换&小地图模糊问题解决 2021-05-07 18:41:37 +08:00
9bc3864790 Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2021-05-01 01:03:24 +08:00
39d84e2e8a 海拔头像移动bug修复 2021-05-01 01:02:54 +08:00
6b380b3442 Merge remote-tracking branch 'origin/dev' into dev_cyp
# Conflicts:
#	Assets/Scenes/1-Login.unity
2021-05-01 00:14:22 +08:00
3ec804f1b0 小调整 2021-05-01 00:11:27 +08:00
d96721e826 Merge remote-tracking branch 'origin/dev' into dev 2021-04-30 23:58:46 +08:00
071a0e1170 调整大地图样式和地球样式 2021-04-30 23:58:11 +08:00
392eca5dc2 人物抖动的问题解决,界面调整,3d视觉调整 2021-04-30 23:45:50 +08:00
af34243c28 修改细节 2021-04-30 21:09:21 +08:00
9f4e446850 修改设备图标。连接设备加缓存功能。 2021-04-30 18:03:34 +08:00
6399c26f7e Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2021-04-30 17:50:37 +08:00
f6a4ebda8c Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp 2021-04-30 17:46:06 +08:00
333542a63a 第一次进地球,登录页bug修改,主页面交互修改,其它细节 2021-04-30 17:46:00 +08:00
2b6be4711c 3d地图优先 2021-04-30 17:45:21 +08:00
48c5b161b1 ant+和http组件bug修复 2021-04-30 17:25:28 +08:00
f7b33bf491 Merge remote-tracking branch 'origin/dev_lishuo' into dev_lishuo 2021-04-29 23:50:17 +08:00
cb93e31143 设备问题修复 2021-04-29 23:49:51 +08:00
52fd841486 修改细节 2021-04-29 23:45:29 +08:00
aaef57c0b0 阻力灵敏度bug 2021-04-29 23:44:47 +08:00
b030294bd6 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Scenes/Ride/Ride.unity
2021-04-29 22:17:24 +08:00
82997480fe 按钮&设置&退出界面调整 2021-04-29 22:16:32 +08:00
44abc5ded1 调整大地图的光 2021-04-29 22:14:17 +08:00
7b4fbc513e 修改细节 2021-04-29 22:05:19 +08:00
8eb201d0ee 伴侣骑行bug修复 2021-04-29 19:01:49 +08:00
a49acaab1e Merge remote-tracking branch 'origin/dev' into dev_lishuo 2021-04-29 18:13:05 +08:00
540bbc9a7c 功体比bug修复 2021-04-29 18:12:40 +08:00
de61fbd291 调整连接设备样式。调整地球样式。去掉灯光。 2021-04-29 18:10:09 +08:00
ae55258b9b 骑行界面按钮替换,界面&逻辑调整 2021-04-29 18:07:30 +08:00
4cb40f2c8e 修改细节,增加图标和splash image,最后需要用破解版打包 2021-04-29 18:05:00 +08:00
b15a4fe2c1 修改细节 2021-04-28 18:41:54 +08:00
9993752ff5 上传记录增加本地保存逻辑 2021-04-28 17:23:29 +08:00
614d067d25 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Scripts/App.cs
2021-04-28 15:49:24 +08:00
6d45d052a0 移除xcharts和细节调整 2021-04-28 15:37:18 +08:00
3b63dec2e1 修正地球自适应问题。修正地图搜索卡死问题。 2021-04-28 15:30:38 +08:00
c8111d7db3 修改细节 2021-04-28 15:22:04 +08:00
b71a15e2ba Merge remote-tracking branch 'origin/dev' into dev_lishuo 2021-04-27 20:28:24 +08:00
00b9c7e796 骑行数据逻辑调整 2021-04-27 20:28:03 +08:00
5080503ebd 添加地球 2021-04-27 19:47:02 +08:00
86a5b68317 修改细节 2021-04-27 19:29:22 +08:00
8226b8a7c2 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo 2021-04-27 15:15:59 +08:00
4353a38c96 本地合并备份 2021-04-27 15:15:51 +08:00
1002b0433a 接动态地图,忘记密码,文件弹窗置顶 2021-04-27 14:58:49 +08:00
2b275d6dc5 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/UI/Prefab/ResultList/RouteItem.cs
2021-04-25 19:43:07 +08:00
02b8f97d83 细节调整 2021-04-25 19:41:35 +08:00
8de7e94c8d 键盘bug,细节调整 2021-04-25 19:35:41 +08:00
bbc3deeef2 Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts:
#	Assets/Scripts/Utils/Utils.cs
2021-04-25 13:51:21 +08:00
0f8af223fc 微调 2021-04-25 13:49:13 +08:00
048538a0c8 修改细节 2021-04-25 13:35:07 +08:00
9ac7c86ca6 移动动效和界面调整 2021-04-25 13:33:43 +08:00
11fdcff7c3 动画文件 2021-04-23 19:30:04 +08:00
922f66bb75 界面调整 2021-04-23 19:28:35 +08:00
a96d538dc1 Merge remote-tracking branch 'origin/dev' into dev_lishuo 2021-04-23 09:37:55 +08:00
d35c9daa82 合并前备份 2021-04-23 09:37:41 +08:00
4347a8eeba 细节调整 2021-04-23 09:22:12 +08:00
dd08f916eb 意见反馈 修改细节 2021-04-23 09:12:32 +08:00
96f3644b5b graph chart引入&骑行结果弹窗 2021-04-22 19:29:59 +08:00
40d118cea3 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Mapbox/User/Modifiers.meta
#	Assets/Resources/UI/Control/PFUISlider.prefab.meta
#	Assets/StreamingAssets.meta
2021-04-21 14:09:34 +08:00
e7ad9473a5 新版骑行页面前备份 2021-04-21 14:08:45 +08:00
1c712ff7d5 加确认框。按钮加tooltips。调整大地图tips的位置。 2021-04-21 11:25:52 +08:00
bb4fabc833 设置页面,调些细节 2021-04-21 11:19:31 +08:00
4896fab824 loading图片遗留bug修复 2021-04-19 18:38:28 +08:00
f10eeac073 Merge remote-tracking branch 'origin/dev' into dev_lishuo 2021-04-19 18:17:27 +08:00
2d20edf57a 加淡入淡出效果。重设字体。加退出导航。 2021-04-19 18:16:56 +08:00
82923fe4f8 骑行界面字体 2021-04-19 18:03:04 +08:00
51c6fd7236 细节调整 2021-04-19 17:59:45 +08:00
af63072f29 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Resources/Apis/Models.meta
#	Assets/Scripts/UI/Prefab/ResultList/RouteItem.cs
2021-04-19 14:40:43 +08:00
afba150d91 继骑&重骑骑行结果页细节调整 2021-04-19 14:38:31 +08:00
f065bf4bbb 调整样式 2021-04-19 14:36:08 +08:00
19766db051 Merge branch 'dev_cyp' into dev
# Conflicts:
#	Assets/Resources/Loading.meta
#	Assets/Scripts/Apis/MapApi.cs
#	Assets/Scripts/UI/Prefab/Panel/MapListController.cs
2021-04-19 14:15:34 +08:00
0346b650aa 暂存 2021-04-19 14:11:53 +08:00
018699c944 Loading页面渐隐 2021-04-16 11:23:18 +08:00
10c82703f4 人物移动调整 2021-04-15 17:29:32 +08:00
70626ae741 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/NuGet.meta
#	Assets/Resources/Images/Ride.meta
#	Assets/Resources/Sound.meta
#	Assets/Scripts/App.cs
#	Assets/Scripts/UI/Prefab/BigMap/Tips.cs
#	Assets/StreamingAssets.meta
2021-04-15 17:14:00 +08:00
92e43c2cd8 路线产生逻辑微调 2021-04-15 17:09:35 +08:00
f4cbad819b Merge remote-tracking branch 'origin/dev' into dev_cyp
# Conflicts:
#	Assets/Resources/Images/back.png.meta
#	Assets/Resources/Images/change account.png.meta
#	Assets/Scripts/UI/Prefab/Panel/EditUserController.cs
2021-04-15 15:59:57 +08:00
c97bd50f3f 暂存 2021-04-15 15:58:37 +08:00
e04ae0b085 细节调整 2021-04-15 15:57:29 +08:00
62938ec6ae Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Scripts/Apis/MapApi.cs
#	Assets/Scripts/App.cs
2021-04-15 10:22:55 +08:00
7744eec847 伴侣骑行 2021-04-15 10:13:01 +08:00
038720e7bd Merge branch 'modify-ui' into dev
# Conflicts:
#	Assets/Scripts/UI/Prefab/Panel/HomeController.cs
#	Assets/Scripts/Utils/Utils.cs
2021-04-15 09:24:15 +08:00
d22eecd133 完成大地图主要界面 2021-04-15 09:01:07 +08:00
10e738f958 登录页调整 增加半圆角组件 基本完成路线列表功能 基本完成骑行列表 开始做编辑页 2021-04-14 17:57:52 +08:00
34cde86a28 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Scripts/Apis/UserApi.cs
#	Assets/Scripts/App.cs
#	Assets/Scripts/ConfigHelper.cs
#	Assets/Scripts/Scenes/LoginController.cs
#	Assets/Scripts/UI/Prefab/Panel/HomeController.cs
2021-04-12 17:42:56 +08:00
2fcd9b23fa 附近的人 2021-04-12 17:35:56 +08:00
5156473bb2 加弹框。修改连接设备样式。 2021-04-09 09:44:06 +08:00
07feba912c 浏览器嵌入,国旗文件 2021-04-09 09:19:04 +08:00
725b510748 动态海拔图,全路线小地图,骑行记录上传增加截图 2021-04-07 17:22:45 +08:00
65fc5b5c50 场景加载处理一些卡顿的情况 2021-04-02 19:17:23 +08:00
e7a3214cb5 设备连接页加返回按钮 2021-04-01 14:29:58 +08:00
ae9cefc645 Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts:
#	Assets/Cyp/Prefab.meta
#	Assets/Mapbox/Core/Plugins/Android.meta
#	Assets/Mapbox/Core/Plugins/Mapbox.meta
#	Assets/Mapbox/Core/Plugins/Mapbox/MapboxAccounts.meta
#	Assets/Plugins/Circle/ImageWithRoundedCorners.cs
#	Assets/Resources/Images/Devices.meta
#	Assets/Resources/UI/Prefab/Item.meta
#	Assets/Scripts/Devices/Ant/LegacyPages.meta
#	Assets/Scripts/UI/Prefab/Item.meta
#	Assets/StreamingAssets.meta
#	ProjectSettings/EditorBuildSettings.asset
2021-04-01 14:09:23 +08:00
ec7589096f 实现连接设备界面 2021-04-01 11:09:53 +08:00
2e6338bcf3 新增人物控制器抽象类 2021-04-01 11:01:29 +08:00
996f924719 登录页一些特效,路书列表详情框架 2021-04-01 11:01:05 +08:00
eb93577d68 修改坡度计算逻辑,骑行界面大部分完成 2021-03-31 20:46:57 +08:00
b0f6c39118 处理合并冲突 2021-03-30 20:00:11 +08:00
8638cd97de Merge branch 'dev_lishuo' of https://gitlab.com/rhino4biz/powerfun/powerfun-unity into dev_lishuo
# Conflicts:
#	Assets/DOTween.meta
#	Assets/Mapbox/Core/Plugins/Android.meta
#	Assets/Mapbox/Unity/Map/InitializeMapWithLocationProvider.cs
#	Assets/Plugins/Newtonsoft.Json.dll
#	Assets/Prefabs.meta
#	Assets/Resources.meta
#	Assets/Scenes/Ride/Minimap Render Texture.renderTexture
#	Assets/Scenes/Ride/Ride.unity
#	Assets/Scenes/Ride/Scripts/Helper.cs
#	Assets/Scenes/Ride/Scripts/PlayerController.cs
#	Assets/Scenes/Ride/Scripts/RouteController.cs
#	Assets/Scenes/Ride/Scripts/UIManager.cs
#	Packages/manifest.json
#	Packages/packages-lock.json
2021-03-30 19:35:32 +08:00
dad88828d2 合并后处理冲突 2021-03-30 19:32:11 +08:00
9a7830f46a 骑行界面调整,底层逻辑细化 2021-03-30 17:30:29 +08:00
d5133ee7b0 骑行界面UI 2021-03-30 17:29:40 +08:00
8ad36c965d 海拔图和小地图 2021-03-30 17:29:40 +08:00
42fa59d103 解决相机抖动和人物移动动画不流畅的问题 2021-03-30 17:29:39 +08:00
0ab0e99597 骑行计算逻辑调整 2021-03-30 17:29:39 +08:00
971a6f7e0e 单人骑行 2021-03-30 17:27:50 +08:00
326b74bd03 注释模态窗口 2021-03-30 14:27:09 +08:00
3c2bb10f07 加ant+相关代码。 2021-03-30 14:23:41 +08:00
f45711f39f 登录页一些效果,接路线列表页 2021-03-30 14:14:24 +08:00
db3fc6ee83 骑行界面UI 2021-03-29 20:32:30 +08:00
d1d9c92f1c Merge remote-tracking branch 'origin/dev' into dev_cyp 2021-03-29 10:00:31 +08:00
cbc79df8a2 暂存 2021-03-29 09:19:48 +08:00
38d1c387c3 加场景切换和事件绑定功能 2021-03-29 09:10:59 +08:00
c5bd9daba2 海拔图和小地图 2021-03-28 18:17:15 +08:00
e7044b3cde 前两个页面迁移完成 2021-03-26 09:50:04 +08:00
ba324aa68d 主场景迁移 2021-03-25 17:18:51 +08:00
ba994e715c Merge branch 'dev_cyp' into dev
# Conflicts:
#	Assets/Resources.meta
2021-03-25 16:58:03 +08:00
b7cc1653f4 ignore 2021-03-25 16:57:30 +08:00
6f7c4e78bd 暂存 2021-03-25 16:55:36 +08:00
4ecf26ec80 添加uimanager和主场景 2021-03-25 16:53:39 +08:00
45801dff22 解决相机抖动和人物移动动画不流畅的问题 2021-03-25 16:22:09 +08:00
60d12fcab2 骑行计算逻辑调整 2021-03-23 16:07:31 +08:00
398628017c 单人骑行 2021-03-22 19:20:51 +08:00
f557e2f5df 添加nuget和网络请求api 2021-03-22 16:06:28 +08:00
9320 changed files with 2155153 additions and 542 deletions

40
.gitignore vendored
View File

@ -69,3 +69,43 @@ crashlytics-build.properties
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
Assets/Packages
Assets/Packages.meta
Assets/Shader2D-master
Assets/ZFBrowser
Assets/Resources/UI/Font/*.ttf
Assets/WorldPoliticalMapGlobeEdition
Assets/WorldPoliticalMapGlobeEdition.meta
Assets/earth
Assets/Chart And Graph
Assets/NuGet
Assets/NuGet.meta
Assets/earth.meta
Assets/MapWorkoutRecords.meta
Assets/Devices.txt
Assets/Devices.txt.meta
Assets/StreamingAssets.meta
Assets/Resources/Sound.meta
Assets/MapWorkoutRecords
Assets/Mapbox/User
Assets/Mapbox/User.meta
Packages/packages-lock.json
GPUCache
Assets/Shatalmic/plugin.unitypackage.meta
.idea
Assets/AVProVideo
Assets/StreamingAssets/AVProVideoSamples
Assets/StreamingAssets/AVProVideoSamples.meta
Assets/StreamingAssets
Assets/FacebookSDK
Assets/StreamingAssets
Assets/Models/MC_animations
Assets/Models/MC_max
Assets/FacebookSDK/SDK/Resources/FacebookSettings.asset
Assets/FacebookSDK/SDK/Resources/FacebookSettings.asset
Assets/AVProVideo.meta
Packages
Assets/Tree_Textures.meta
Packages
Assets/FacebookSDK/SDK/Resources.meta
Packages

6
.vsconfig Normal file
View File

@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}

130
Assets/AndroidUpdate.cs Normal file
View File

@ -0,0 +1,130 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class AndroidUpdate : PFUIPanel
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
JObject data { get; set; }
public void StartDownload(JObject jo)
{
transform.Find("Panel/CurrentVersion").GetComponent<Text>().text = $"{App.GetLocalString("Current Version:")} {App.AppVersion}";
transform.Find("Panel/LastestVersion").GetComponent<Text>().text = $"{App.GetLocalString("Latest Version:")} {jo.Value<string>("Version")}";
data = jo;
var path = Application.temporaryCachePath + "/PowerFun.apk";
StartCoroutine(DownLoadExe(data.Value<string>("Url"), path, (p, isComplete) =>
{
transform.Find("Panel/Size").GetComponent<Text>().text = $"{App.GetLocalString("Downloaded")} {Math.Round(p * 100, 0)}%";// string.Format(, a, b);
transform.Find("Panel/Progress").GetComponent<Image>().fillAmount = (float)p;
if (isComplete)
{
PlayerPrefs.SetString("exeVersion", data.Value<string>("Version"));
new FileInfo(path + ".pfdownload").MoveTo(path);
OpenApk(path);
//Application.Quit();
}
}));
}
/*下载文件*/
IEnumerator DownLoadExe(string url, string desFileName, Action<double, bool> OnDownloadProgressEvent)
{
string version = data.Value<string>("Version");
if (File.Exists(desFileName))
{
//if(PlayerPrefs.GetString("exeVersion")==)
if (version == null)
{
yield break;
}
else
{
if (version == PlayerPrefs.GetString("exeVersion"))
{
OpenApk(desFileName);
//Application.Quit();
yield break;
}
else
{
File.Delete(desFileName);
}
}
//File.Delete(desFileName);
}
if (File.Exists(desFileName + ".pfdownload"))
{
File.Delete(desFileName + ".pfdownload");
}
using (var uwr = UnityWebRequest.Get(url))
{
var operation = uwr.SendWebRequest();
while (!operation.isDone)
{
/*
* as BugFinder metnioned in the comments
* what you want to track is uwr.downloadProgress
*/
var downloadDataProgress = uwr.downloadProgress * 100;
/*
* use a float division here
* I don't know what type downloadDataProgress is
* but if it is an int than you will always get
* an int division <somethingSmallerThan100>/100 = 0
*/
//progressBar.fillAmount = downloadDataProgress / 100.0f;
OnDownloadProgressEvent.Invoke(uwr.downloadProgress, false);
Debug.Log("Download: " + downloadDataProgress);
yield return null;
}
ByteArrayToFile(desFileName + ".pfdownload", uwr.downloadHandler.data);
OnDownloadProgressEvent.Invoke(1, true);
}
}
bool ByteArrayToFile(string fileName, byte[] byteArray)
{
try
{
using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
{
fs.Write(byteArray, 0, byteArray.Length);
return true;
}
}
catch (Exception ex)
{
Debug.LogError(ex);
return false;
}
}
void OpenApk(string path)
{
#if !UNITY_EDITOR
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
var activity = jc.GetStatic<AndroidJavaObject>("currentActivity");
//Debug.Log("打开apk"+ "file://" + path);
activity.Call("OpenApk", path);
//Application.Quit();
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ef1001f46abd4064a9837992f252bb97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,159 @@
using Assets.Scripts;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AppleInfoController : PFUIPanel
{
public Action afterClose = null;
private SignForm signForm;
private Dictionary<string, Selectable> signFormDict;
public bool startCaptcha = false;
protected override void Awake()
{
UIManager.AddEvent(transform.Find("FormContainer-Sign/btnClose").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Close();
//if (afterClose != null)
//{
// afterClose.Invoke();
//}
});
signForm = new SignForm()
{
email = transform.Find("FormContainer-Sign/FirstPage/Email").GetComponent<InputField>(),
captcha = transform.Find("FormContainer-Sign/FirstPage/Captcha").GetComponent<InputField>(),
password = transform.Find("FormContainer-Sign/FirstPage/Password").GetComponent<InputField>(),
cpassword = transform.Find("FormContainer-Sign/FirstPage/CPassword").GetComponent<InputField>(),
};
signFormDict = new Dictionary<string, Selectable>
{
{ "Phone",signForm.email},
{ "Captcha",signForm.captcha},
{ "Pwd",signForm.password},
{ "CPwd",signForm.cpassword},
};
signPage1 = transform.Find("FormContainer-Sign/FirstPage");
UIManager.AddEvent(signPage1.Find("Captcha").Find("BtnGet").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
GetCaptcha();
});
UIManager.AddEvent(signPage1.Find("next").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
Submit();
});
}
private async void Submit()
{
if (signForm.password.text != signForm.cpassword.text)
{
Utils.SetValidate(signFormDict, JArray.FromObject(new object[]
{
new { Field="Pwd"},
new { Field="CPwd"},
}));
Utils.showToast(gameObject, "Two password entries are inconsistent");//两次密码输入不一致
return;
}
var res = await ConfigHelper.userApi.AppleCompleteInfo(signForm.email.text, signForm.captcha.text, signForm.password.text);
if (res.result)
{
Utils.showToast(null, App.GetLocalString("Success"), type: 1);
App.CurrentUser.Phone = signForm.email.text;
if (afterClose != null)
{
afterClose.Invoke();
}
Close();
}
else
{
Utils.SetValidate(signFormDict, JArray.FromObject(res.data));
Utils.showToast(null, res.errMsg);
}
}
float timer = 1f;
int time = 60;
Transform signPage1;
async void GetCaptcha()
{
var btn = signPage1.Find("Captcha").Find("BtnGet");
btn.GetComponent<Button>().enabled = false;
btn.GetComponent<Button>().interactable = false;
var btnText = btn.Find("Text").GetComponent<Text>();
var Email = signForm.email;
var r = await ConfigHelper.userApi.GetCaptcha(Email.text);
//Timer t = new Ti
if (r.result)
{
//if (r.data.Value<bool>("isExist"))
//{
// signPage1.Find("Password").gameObject.SetActive(false);
// signPage1.Find("CPassword").gameObject.SetActive(false);
//}
//else
//{
// signPage1.Find("Password").gameObject.SetActive(true);
// signPage1.Find("CPassword").gameObject.SetActive(true);
//}
time = 60;
btnText.text = $"Again({time})";
btn.GetComponent<Button>().enabled = false;
btn.GetComponent<Button>().interactable = false;
startCaptcha = true;
//timer.Interval = 1000;
//timer.AutoReset = true;
//timer.Elapsed += new ElapsedEventHandler(CaptchaTimerTick);
//timer.Enabled = true;
//btnGet.
}
else
{
btn.GetComponent<Button>().enabled = true;
btn.GetComponent<Button>().interactable = true;
Utils.showToast(gameObject, r.errMsg);
Utils.SetValidate(signFormDict, r.errFieldMsg);
}
}
void CaptchaTimerTick()
{
timer -= Time.deltaTime;
if (timer <= 0)
{
var btn = signPage1.Find("Captcha").Find("BtnGet");
var btnText = signPage1.Find("Captcha").Find("BtnGet").Find("Text").GetComponent<Text>();
btnText.text = $"{App.GetLocalString("Again")}({time--})";
if (time < 0)
{
btnText.text = App.GetLocalString("Get");
btn.GetComponent<Button>().enabled = true;
btn.GetComponent<Button>().interactable = true;
startCaptcha = false;
//timer.Stop();
}
timer += 1.0f;
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (startCaptcha)
{
CaptchaTimerTick();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6a404dcc72dc4894c835c2097a5ad469
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

282
Assets/BannerController.cs Normal file
View File

@ -0,0 +1,282 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class BannerController : MonoBehaviour
{
// Start is called before the first frame update
private List<CanvasGroup> itemList;
private List<Vector3> standardPositions;
private List<Recommand> list;
private int currentIndex = 1;
private Dictionary<string, Texture> caches;
void Awake()
{
itemList = new List<CanvasGroup>
{
transform.Find("1").GetComponent<CanvasGroup>(),
transform.Find("2").GetComponent<CanvasGroup>(),
transform.Find("3").GetComponent<CanvasGroup>()
};
caches = new Dictionary<string, Texture>();
standardPositions = new List<Vector3>
{
transform.Find("1").localPosition,transform.Find("2").localPosition,transform.Find("3").localPosition
};
AddTouchEvent();
Debug.Log(standardPositions[0]);
Debug.Log(standardPositions[1]);
Debug.Log(standardPositions[2]);
}
TKPanRecognizer pan;
private void AddTouchEvent()
{
pan = new TKPanRecognizer();
var panList = new List<CanvasGroup>();
pan.gestureRecognizedEvent += (r) =>
{
if (!App.currentPageIsHome) return;
int center = GetCenterIndex(),
left = GetSideIndex(true),
right = GetSideIndex(false);
if (!(center == -1 || left == -1 || right == -1) && panList.Count == 0)
{
panList.Add(itemList[left]);
panList.Add(itemList[center]);
panList.Add(itemList[right]);
}
if (panList.Count == 0) return;
var startPoint = r.startTouchLocation();
if (((RectTransform)transform).isPointInTransfrom(startPoint))
{
foreach (var item in panList)
{
item.GetComponent<Button>().onClick.RemoveAllListeners();
}
var offset = pan.deltaTranslation;
if (panList[1].transform.localPosition.x == 0)
{
panList[1].transform.DOScale(0.8f, 0.5f);
}
if (offset.x > 0)
{
//-43 0 43
//后面的 如果往左,需要回到-43再往右
panList[0].transform.localPosition += new Vector3(1, 0, 0);
panList[1].transform.localPosition += new Vector3(1, 0, 0);
panList[2].transform.localPosition += new Vector3(-1, 0, 0);
}
else if (offset.x < 0)
{
panList[0].transform.localPosition += new Vector3(1, 0, 0);
panList[1].transform.localPosition += new Vector3(-1, 0, 0);
//后面的 如果往右需要回到43再往左
panList[2].transform.localPosition += new Vector3(-1, 0, 0);
}
}
else
{
panList.Clear();
}
};
pan.gestureCompleteEvent += (r) =>
{
if (!App.currentPageIsHome) return;
if (panList.Count == 0) return;
if (panList[1].transform.localPosition.x < 0)
{
DOLeft(panList[0], panList[1], panList[2]);
}
else
{
DORight(panList[0], panList[1], panList[2]);
}
panList.Clear();
};
TouchKit.addGestureRecognizer(pan);
}
int sIndex = 0, eIndex = 2;
private void Start()
{
GetList();
}
async void GetList()
{
var res = await ConfigHelper.mapApi.GetRecommendList();
if (res.result)
{
if (res.data.Count >= 3)
{
sIndex = 0;eIndex = 2;
Initial(res.data);
gameObject.SetActive(true);
}
else
{
gameObject.SetActive(false);
}
}
}
public void Initial(List<Recommand> list)
{
int index = 0;
foreach (CanvasGroup c in itemList)
{
var area = list[index++];
c.GetComponent<RecommendController>().Initial(area, caches);
c.GetComponent<Button>().onClick.RemoveAllListeners();
if (c.alpha != 1)
{
if (c.transform.localPosition.x < 0)
{
c.GetComponent<Button>().onClick.AddListener(Right);
}
else
{
c.GetComponent<Button>().onClick.AddListener(Left);
}
}
else
{
c.GetComponent<Button>().onClick.AddListener(()=>GoDetail(c));
}
}
this.list = list;
}
bool animateLock = false;
private void Right()
{
int center = GetCenterIndex(),
left = GetSideIndex(true),
right = GetSideIndex(false);
if (center == -1 || left == -1 || right == -1 || animateLock) return;
animateLock = true;
if (leftse != null) leftse.Complete(true);
DORight(itemList[left], itemList[center], itemList[right]);
}
void DORight(CanvasGroup left, CanvasGroup center, CanvasGroup right)
{
Sequence se = DOTween.Sequence();
se.Join(center.DOFade(0.5f, 0.3f));
se.Join(center.GetComponent<RectTransform>().DOScale(Vector3.one * 0.8f, 0.3f));
se.Join(center.GetComponent<RectTransform>().DOLocalMoveX(offset, 0.3f));
se.Join(right.GetComponent<RectTransform>().DOLocalMoveX(-1* offset, 0.3f));
var area = list[((sIndex - 1) + list.Count) % list.Count];
sIndex--;
eIndex--;
if (sIndex < 0) sIndex = (sIndex + list.Count) % list.Count;
if (eIndex < 0) eIndex = (eIndex + list.Count) % list.Count;
Debug.Log($"{sIndex},{eIndex}");
right.GetComponent<RecommendController>().Initial(area, caches);
se.Join(left.DOFade(1, 0.3f));
se.Join(left.GetComponent<RectTransform>().DOScale(Vector3.one, 0.3f));
se.Join(left.GetComponent<RectTransform>().DOLocalMoveX(0, 0.3f));
se.Play().onComplete = ()=> { animateLock = false; };
rightse = se;
left.transform.SetAsLastSibling();
//事件改变
left.GetComponent<Button>().onClick.RemoveAllListeners();
left.GetComponent<Button>().onClick.AddListener(() => GoDetail(left));
center.GetComponent<Button>().onClick.RemoveAllListeners();
center.GetComponent<Button>().onClick.AddListener(Left);
right.GetComponent<Button>().onClick.RemoveAllListeners();
right.GetComponent<Button>().onClick.AddListener(Right);
}
#if UNITY_STANDALONE_WIN
float offset = 110;
#else
float offset = 43;
#endif
Sequence leftse, rightse;
private void Left()
{
int center = GetCenterIndex(),
left = GetSideIndex(true),
right = GetSideIndex(false);
if (center == -1 || left == -1 || right == -1|| animateLock) return;
animateLock = true;
if (rightse != null) rightse.Complete(true);
DOLeft(itemList[left], itemList[center], itemList[right]);
}
void DOLeft(CanvasGroup left, CanvasGroup center, CanvasGroup right)
{
Sequence se = DOTween.Sequence();
se.Join(center.DOFade(0.5f, 0.3f));
se.Join(center.GetComponent<RectTransform>().DOScale(Vector3.one * 0.8f, 0.3f));
se.Join(center.GetComponent<RectTransform>().DOLocalMoveX(-1* offset, 0.3f));
se.Join(left.GetComponent<RectTransform>().DOLocalMoveX(offset, 0.3f));
var area = list[((eIndex + 1) + list.Count) % list.Count];
sIndex++;
eIndex++;
if (sIndex >= list.Count - 1) sIndex = sIndex % list.Count;
if (eIndex >= list.Count - 1) eIndex = eIndex % list.Count;
Debug.Log($"{sIndex},{eIndex}");
var centerArea = list[currentIndex + 1];
left.GetComponent<RecommendController>().Initial(area, caches);
if (currentIndex < 0) currentIndex = list.Count - 1;
se.Join(right.DOFade(1, 0.3f));
se.Join(right.GetComponent<RectTransform>().DOScale(Vector3.one, 0.3f));
se.Join(right.GetComponent<RectTransform>().DOLocalMoveX(0, 0.3f));
se.Play().onComplete = () => { animateLock = false; };
leftse = se;
right.transform.SetAsLastSibling();
//事件改变
right.GetComponent<Button>().onClick.RemoveAllListeners();
right.GetComponent<Button>().onClick.AddListener(() => GoDetail(right));
center.GetComponent<Button>().onClick.RemoveAllListeners();
center.GetComponent<Button>().onClick.AddListener(Right);
left.GetComponent<Button>().onClick.RemoveAllListeners();
left.GetComponent<Button>().onClick.AddListener(Left);
}
int GetCenterIndex()
{
return itemList.FindIndex(x => x.transform.localPosition.x == 0);
}
int GetSideIndex(bool left)
{
return itemList.FindIndex(x => left ? x.transform.localPosition.x < 0 : x.transform.localPosition.x > 0);
}
void GoDetail(CanvasGroup c)
{
if (c.transform.localPosition.x == 0)
{
var se = DOTween.Sequence();
se.Append(c.transform.DOScale(1.05f * Vector3.one, 0.15f));
se.Append(c.transform.DOScale(1f * Vector3.one, 0.15f));
se.Play().onComplete = ()=>
{
c.GetComponent<RecommendController>().DoWithType();
};
}
}
float autoTime = 5;
// Update is called once per frame
void Update()
{
autoTime -= Time.deltaTime;
if (autoTime < 0)
{
Left();
autoTime += 5;
}
}
private void OnDestroy()
{
Debug.Log(248+"毁灭");
TouchKit.removeGestureRecognizer(pan);
caches = null;
Resources.UnloadUnusedAssets();
GC.Collect();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99085319355aa0f44a5db27b26f6ec95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 21ab74f6196c6da4eb277c2615345f1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,19 @@
The following 3rd parties are integrated into Graph and Chart:
In the folder Chart And Graph/Themes/Common/Fonts :
Each font has it's own folder with full license detials
Exo2 - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/exo-2
ABeeZee - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/abeezee
Comprehension - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/comprehension
Enriqueta - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/enriqueta
Fengardo-neue - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/fengardo-neue
Overpass - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/overpass
Rambla - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/rambla
Scada - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/scada
SimpleJson in the folder Chart And Graph/SimpleJSON-master:
Licensed under MIT license :https://github.com/Bunny83/SimpleJSON/blob/master/LICENSE

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b593c70250d4fb94bb76f653a500cd6d
timeCreated: 1536774863
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c3cc22ffba1b29a44b56007d189a1750
folderAsset: yes
timeCreated: 1536396364
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public abstract class ChartParser
{
public abstract bool SetPathRelativeTo(string pathObject);
/// <summary>
/// returns null if object not found
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public abstract object GetObject(string name);
public abstract object GetChildObject(object obj, string name);
public abstract IEnumerable<KeyValuePair<string , object>> GetAllChildObjects(object obj);
public abstract string GetChildObjectValue(object obj, string name);
public abstract string GetItem(object arr, int item);
public abstract object GetItemObject(object arr, int item);
public abstract int GetArraySize(object arr);
public abstract string ObjectValue(object obj);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5948d4ad51f370c4f927d0d10573cc84
timeCreated: 1536396364
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,134 @@
#define Graph_And_Chart_PRO
using SimpleJSON;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
class JsonParser : ChartParser
{
JSONNode mBaseJson;
JSONNode mRelativePath;
public JsonParser(string data)
{
mBaseJson = JSON.Parse(data);
mRelativePath = mBaseJson;
}
object GetObjectFromRoot(JSONNode root, string name)
{
string[] parents = name.Split('>');
object current = root;
for (int i = 0; current != null && i < parents.Length; i++)
{
string nextNode = parents[i];
current = GetChildObject(current, nextNode);
}
return current;
}
public override int GetArraySize(object arr)
{
var node = (JSONNode)arr;
if (node.IsArray == false)
return 0;
return node.Count;
}
public override object GetChildObject(object obj, string name)
{
var node = (JSONNode)obj;
if (name.Length <= 0)
return obj;
if (char.IsDigit(name[0])) // if it is a number then find by order , atag name cannot start with a digit
{
if (node.IsArray == false)
return null;
int index = 0;
if (int.TryParse(name, out index) == false) // try parsing the number
return null;
if (index < 0 || index >= node.Count)
return null;
return node[index];
}
if(name.Length>=2 && name[0] == '"' && name[name.Length-1] == '"')
{
name = name.Substring(1, name.Length - 2); //strip quatation marks
}
return node[name];
}
public override bool SetPathRelativeTo(string pathObject)
{
mRelativePath = (JSONNode)GetObjectFromRoot(mBaseJson, pathObject);
if (mRelativePath == null)
{
mRelativePath = mBaseJson;
return false;
}
return true;
}
public override object GetObject(string name)
{
return GetObjectFromRoot(mRelativePath, name);
}
public override string GetItem(object arr, int item)
{
var element = arr as JSONNode;
if (element == null)
return null;
var child = element[item] as JSONNode;
if (child == null)
return null;
return ObjectValue(child);
}
public override object GetItemObject(object arr, int item)
{
var element = arr as JSONNode;
if (element == null)
return null;
var child = element[item];
return child;
}
public override string ObjectValue(object obj)
{
var element = obj as JSONNode;
return element.Value;
}
public override string GetChildObjectValue(object obj, string name)
{
var element = obj as JSONNode;
if (element == null)
return null;
try
{
var child = element[name] as JSONNode;
return ObjectValue(child);
}
catch(Exception)
{
}
return null;
}
public override IEnumerable<KeyValuePair<string, object>> GetAllChildObjects(object obj)
{
var node = (JSONNode)obj;
if (node.IsObject == false)
yield break;
foreach(var key in node.Keys)
yield return new KeyValuePair<string, object>(key, node[key]);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0693b788053aab64a88908e1e3d6b944
timeCreated: 1536396364
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,146 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
#if WINDOWS_UWP
using Windows.Data.Xml.Dom;
#else
using System.Xml;
#endif
namespace ChartAndGraph
{
class XMLParser : ChartParser
{
XmlDocument mXmlDoc;
XmlElement mRelativeElement;
public XMLParser(string xml)
{
mXmlDoc = new XmlDocument();
#if WINDOWS_UWP
mXmlDoc.LoadXml(xml);
#else
using (var reader = new StringReader(xml))
{
mXmlDoc.Load(reader);
}
#endif
mRelativeElement = mXmlDoc.DocumentElement;
}
public override int GetArraySize(object arr)
{
var element = arr as XmlElement;
if (element == null)
return 0;
return element.ChildNodes.Count;
}
public override object GetChildObject(object obj, string name)
{
var node = (XmlElement)obj;
if (name.Length <= 0)
return obj;
if (char.IsDigit(name[0])) // if it is a number then find by order , atag name cannot start with a digit
{
int index = 0;
if (int.TryParse(name, out index) == false) // try parsing the number
return null;
if (index < 0 || index >= node.ChildNodes.Count)
return null;
return node.ChildNodes[index];
}
return node.SelectSingleNode(name);
}
public override object GetItemObject(object arr, int item)
{
var element = arr as XmlElement;
if (element == null)
return null;
var child = element.ChildNodes[item] as XmlElement;
return child;
}
object GetObjectFromRoot(XmlElement root, string name)
{
string[] parents = name.Split('>');
object current = root;
for (int i = 0; current != null && i < parents.Length; i++)
{
string nextNode = parents[i];
current = GetChildObject(current, nextNode);
}
return current;
}
public override object GetObject(string name)
{
return GetObjectFromRoot(mRelativeElement, name);
}
public override bool SetPathRelativeTo(string pathObject)
{
mRelativeElement = (XmlElement)GetObjectFromRoot(mXmlDoc.DocumentElement, pathObject);
if (mRelativeElement == null)
{
mRelativeElement = mXmlDoc.DocumentElement;
return false;
}
return true;
}
public override string GetChildObjectValue(object obj, string name)
{
var element = obj as XmlElement;
if (element == null)
return null;
var child = element.SelectSingleNode(name) as XmlElement;
if (child == null)
return null;
return ObjectValue(child);
}
public override string GetItem(object arr, int item)
{
var element = arr as XmlElement;
if (element == null)
return null;
var child = element.ChildNodes[item] as XmlElement;
if (child == null)
return null;
return ObjectValue(child);
}
public override string ObjectValue(object obj)
{
var element = obj as XmlElement;
if (element == null)
return null;
return element.InnerText;
}
public override IEnumerable<KeyValuePair<string, object>> GetAllChildObjects(object obj)
{
var element = obj as XmlElement;
if (element == null)
yield break;
foreach(var node in element.ChildNodes)
{
var xml = node as XmlElement;
if(xml != null)
{
#if WINDOWS_UWP
yield return new KeyValuePair<string, object>(xml.TagName, xml);
#else
yield return new KeyValuePair<string, object>(xml.Name, xml);
#endif
}
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 878b8742852947849810df5d673d597c
timeCreated: 1536396365
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bf8f979c9af34ff43ab739a7cf401b92
folderAsset: yes
timeCreated: 1560597265
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
[CustomPropertyDrawer(typeof(AutoFloat))]
class AutoFloatInspector : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
label = EditorGUI.BeginProperty(position, label, property);
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
SerializedProperty auto = property.FindPropertyRelative("Automatic");
SerializedProperty val = property.FindPropertyRelative("Value");
int indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
bool res = EditorGUI.ToggleLeft(position,"Auto",auto.boolValue);
EditorGUI.indentLevel = indent;
EditorGUI.indentLevel++;
if (auto.boolValue == false && EditorGUI.showMixedValue == false)
val.floatValue = EditorGUILayout.FloatField("Value",val.floatValue);
auto.boolValue = res;
EditorGUI.indentLevel--;
EditorGUI.EndProperty();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c989bbf118ca01e4aab213559170875f
timeCreated: 1479209594
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,273 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
[CustomEditor(typeof(AxisBase), true)]
class AxisInspector : Editor
{
bool mMain = false;
bool mSub = false;
public override void OnInspectorGUI()
{
AxisBase axis = (AxisBase)target;
if (axis.gameObject == null)
return;
AnyChart chart = axis.gameObject.GetComponent<AnyChart>();
if (chart == null)
return;
if((chart is AxisChart) == false)
{
EditorGUILayout.LabelField(string.Format("Chart of type {0} does not support axis",chart.GetType().Name));
return;
}
SerializedProperty simpleViewProp = serializedObject.FindProperty("SimpleView");
if (simpleViewProp == null)
return;
Type canvasType = (chart is ICanvas) ? typeof(CanvasAttribute) : typeof(NonCanvasAttribute);
EditorGUILayout.BeginVertical();
bool negate = false;
if (simpleViewProp.boolValue == true)
negate = GUILayout.Button("Advanced View");
else
negate = GUILayout.Button("Simple View");
if (negate)
simpleViewProp.boolValue = !simpleViewProp.boolValue;
bool simple = simpleViewProp.boolValue;
SerializedProperty depth = serializedObject.FindProperty("depth");
if (depth != null)
EditorGUILayout.PropertyField(depth);
SerializedProperty format= serializedObject.FindProperty("format");
EditorGUILayout.PropertyField(format);
if (simple)
DoSimpleView(canvasType);
else
DoAdvanvedView(canvasType,true);
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
serializedObject.Update();
}
void SetValue(SerializedProperty assignTo,SerializedProperty from)
{
if(assignTo.propertyType != from.propertyType)
{
Debug.LogWarning("type does not match");
return;
}
if (assignTo.type == "AutoFloat")
{
SerializedProperty auto = assignTo.FindPropertyRelative("Automatic");
SerializedProperty val = assignTo.FindPropertyRelative("Value");
SerializedProperty autofrom = from.FindPropertyRelative("Automatic");
SerializedProperty valfrom = from.FindPropertyRelative("Value");
auto.boolValue = autofrom.boolValue;
val.floatValue = valfrom.floatValue;
return;
}
switch (assignTo.propertyType)
{
case SerializedPropertyType.Float:
assignTo.floatValue = from.floatValue;
break;
case SerializedPropertyType.Integer:
assignTo.intValue = from.intValue;
break;
case SerializedPropertyType.Enum:
assignTo.enumValueIndex = from.enumValueIndex;
break;
case SerializedPropertyType.Boolean:
assignTo.boolValue = from.boolValue;
break;
case SerializedPropertyType.String:
assignTo.stringValue = from.stringValue;
break;
case SerializedPropertyType.ObjectReference:
assignTo.objectReferenceValue = from.objectReferenceValue;
break;
default:
Debug.LogWarning("type cannot be set");
break;
}
}
Type getTypeFromField(Type type,string fieldName)
{
FieldInfo inf = type.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
if (inf == null)
return null;
return inf.FieldType;
}
bool CompareValues(Type type,string fieldName,object a,object b)
{
FieldInfo inf= type.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
object valA = inf.GetValue(a);
object valB = inf.GetValue(b);
if(valA is UnityEngine.Object && valB is UnityEngine.Object)
{
if(((UnityEngine.Object)valA) == ((UnityEngine.Object)valB))
return true;
return false;
}
if (valA == null && valB == null)
return true;
return valA.Equals(valB);
}
void DoSimpleView(Type canvasType)
{
SerializedProperty it = serializedObject.FindProperty("mainDivisions");
SerializedProperty SubDivisions = serializedObject.FindProperty("subDivisions");
object mainDivision = ((AxisBase)target).MainDivisions;
object subDivision = ((AxisBase)target).SubDivisions;
if (it == null || SubDivisions == null)
return;
SerializedProperty end = it.GetEndProperty();
while(it.NextVisible(true) && SerializedProperty.EqualContents(end,it) == false)
{
if (it.name == "SimpleView")
continue;
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), it.name, canvasType) == false)
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), it.name, canvasType) == false)
continue;
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), it.name, typeof(SimpleAttribute)) == false)
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), it.name, typeof(SimpleAttribute)) == false)
continue;
SerializedProperty clone = SubDivisions.FindPropertyRelative(it.name);
if (clone == null)
Debug.LogWarning("can't find property " + it.name);
bool equal = CompareValues(typeof(ChartDivisionInfo), clone.name, mainDivision, subDivision);
Type t = getTypeFromField(typeof(ChartDivisionInfo), clone.name);
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = !equal;
DoMixedFiled(it, t);
EditorGUI.showMixedValue = false;
if (EditorGUI.EndChangeCheck())
SetValue(clone, it);
}
DoAdvanvedView(canvasType,false);
}
public void DoMixedFiled(SerializedProperty prop,Type type)
{
if(prop.type == "AutoFloat")
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel(prop.displayName);
SerializedProperty auto = prop.FindPropertyRelative("Automatic");
SerializedProperty val = prop.FindPropertyRelative("Value");
auto.boolValue = EditorGUILayout.ToggleLeft("Auto", auto.boolValue);
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel++;
if (auto.boolValue == false && EditorGUI.showMixedValue == false)
val.floatValue = EditorGUILayout.FloatField("Value",val.floatValue);
EditorGUI.indentLevel--;
return;
}
switch(prop.propertyType)
{
case SerializedPropertyType.Float:
if(prop.name == "FontSharpness")
prop.floatValue = EditorGUILayout.Slider(prop.displayName, prop.floatValue,1f,3f);
else
prop.floatValue = EditorGUILayout.FloatField(prop.displayName,prop.floatValue);
break;
case SerializedPropertyType.Integer:
if (prop.name == "FractionDigits")
prop.intValue = EditorGUILayout.IntSlider(prop.displayName, prop.intValue,0,7);
else
prop.intValue = EditorGUILayout.IntField(prop.displayName, prop.intValue);
break;
case SerializedPropertyType.Enum:
ChartDivisionAligment selected = (ChartDivisionAligment)Enum.Parse( typeof(ChartDivisionAligment), prop.enumNames[prop.enumValueIndex]);
Enum res = EditorGUILayout.EnumPopup(prop.displayName, selected);
string newName= Enum.GetName(typeof(ChartDivisionAligment), res);
for (int i = 0; i < prop.enumNames.Length; ++i)
{
if (prop.enumNames[i] == newName)
{
prop.enumValueIndex = i;
break;
}
}
break;
case SerializedPropertyType.String:
prop.stringValue = EditorGUILayout.TextField(prop.displayName, prop.stringValue);
break;
case SerializedPropertyType.Boolean:
prop.boolValue = EditorGUILayout.Toggle(prop.displayName, prop.boolValue);
break;
case SerializedPropertyType.ObjectReference:
if(type != null)
prop.objectReferenceValue = EditorGUILayout.ObjectField(prop.displayName, prop.objectReferenceValue, type, true);
break;
default:
Debug.LogWarning("type cannot be set");
break;
}
}
void DoAdvanvedView(Type canvasType,bool includeSimple)
{
SerializedProperty mainDivisions = serializedObject.FindProperty("mainDivisions");
SerializedProperty subDivisions = serializedObject.FindProperty("subDivisions");
mMain =mainDivisions.isExpanded = EditorGUILayout.Foldout(mainDivisions.isExpanded, "Main Divisions");
if (mMain)
{
EditorGUI.indentLevel++;
SerializedProperty end = mainDivisions.GetEndProperty();
while (mainDivisions.NextVisible(true) && SerializedProperty.EqualContents(mainDivisions, end) == false)
{
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), mainDivisions.name, canvasType) == false)
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), mainDivisions.name, canvasType) == false)
continue;
if (includeSimple == false)
{
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), mainDivisions.name, typeof(SimpleAttribute)))
continue;
}
EditorGUILayout.PropertyField(mainDivisions);
}
EditorGUI.indentLevel--;
}
mSub = subDivisions.isExpanded = EditorGUILayout.Foldout(subDivisions.isExpanded, "Sub Divisions");
if (mSub)
{
EditorGUI.indentLevel++;
SerializedProperty end = subDivisions.GetEndProperty();
while (subDivisions.NextVisible(true) && SerializedProperty.EqualContents(subDivisions, end) == false)
{
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), subDivisions.name, canvasType) == false)
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), subDivisions.name, canvasType) == false)
continue;
if (includeSimple == false)
{
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), subDivisions.name, typeof(SimpleAttribute)))
continue;
}
EditorGUILayout.PropertyField(subDivisions);
}
EditorGUI.indentLevel--;
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 898567b381452e94794158c16012f617
timeCreated: 1479124371
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,364 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(BarChart),true)]
class BarChartInspetor : Editor
{
bool mCategories = false;
bool mGroups = false;
string mCategoryError = null;
string mNewCategoryName = "";
string mNewGroupName = "";
string mGroupError = null;
GUIStyle mRedStyle;
GUIStyle mBold;
HashSet<string> mAllNames = new HashSet<string>();
GUIStyle mSplitter;
List<int> mToRemove = new List<int>();
List<int> mToUp = new List<int>();
Dictionary<string, string> mOperations = new Dictionary<string, string>();
ChartDataEditor mWindow;
bool mUpdateWindow = false;
Texture mSettings;
GUIContent MaxBarValue = new GUIContent("Max Bar Value :", "All the bars are scaled according to this value, Bars that are larger then this value are clamped");
GUIContent MinBarValue = new GUIContent("Min Bar Value :", "All the bars are scaled according to this value, Bars that are lower then this value are clamped");
RenameWindow mRenameWindow;
public void OnEnable()
{
mRedStyle = new GUIStyle();
mRedStyle.normal.textColor = Color.red;
mSplitter = new GUIStyle();
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
mSplitter.stretchWidth = true;
mSplitter.margin = new RectOffset(0, 0, 7, 7);
}
public void Splitter()
{
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
if (Event.current.type == EventType.Repaint)
{
Color restoreColor = GUI.color;
GUI.color = new Color(0.5f, 0.5f, 0.5f);
mSplitter.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
private void DoOperations(SerializedProperty items,int size,string type)
{
mToRemove.Clear();
mToUp.Clear();
bool up = false;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
string arg = type + "|" + name;
string res = null;
if (up == true)
{
mToUp.Add(i);
up = false;
}
if (mOperations.TryGetValue(arg, out res))
{
if (res == "remove")
mToRemove.Add(i);
if (res == "up" && i > 0)
mToUp.Add(i);
if (res == "down")
up = true;
mOperations.Remove(arg);
}
}
for (int i = 0; i < mToRemove.Count; i++)
items.DeleteArrayElementAtIndex(mToRemove[i]);
for (int i = 0; i < mToUp.Count; i++)
{
int cur = mToUp[i];
items.MoveArrayElement(cur, cur - 1);
}
}
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
{
SerializedProperty items = data.FindPropertyRelative(property);
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
//bool up, down;
mAllNames.Clear();
int size = items.arraySize;
if (Event.current.type == EventType.Layout)
DoOperations(items, size, type);
size = items.arraySize;
if (items.isExpanded)
{
EditorGUI.indentLevel++;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
mAllNames.Add(name);
EditorGUILayout.BeginHorizontal();
bool toogle = false;
if (nameProp != null)
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
else
{
toogle = false;
EditorGUILayout.LabelField(name);
}
GUILayout.FlexibleSpace();
if(GUILayout.Button("..."))
DoContext(type, name);
EditorGUILayout.EndHorizontal();
if (toogle)
{
EditorGUI.indentLevel++;
if (nameProp != null)
{
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (entry.name != "Name")
EditorGUILayout.PropertyField(entry, true);
}
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
}
}
EditorGUI.indentLevel--;
}
}
if (errorMessage != null)
EditorGUILayout.LabelField(errorMessage, mRedStyle);
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
EditorGUILayout.BeginHorizontal();
newName = EditorGUILayout.TextField(newName);
//GUILayout.Space(indentAdd.xMin);
if (GUILayout.Button("Add"))
{
bool error = false;
if (newName.Trim().Length == 0)
{
errorMessage = "Name can't be empty";
error = true;
}
else if (ChartEditorCommon.IsAlphaNum(newName) == false)
{
errorMessage = "Name conatins invalid characters";
error = true;
}
else if (mAllNames.Contains(newName))
{
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
error = true;
}
if (error == false)
{
errorMessage = null;
items.InsertArrayElementAtIndex(size);
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
if (newItemName == null)
newItem.stringValue = newName;
else
newItemName.stringValue = newName;
newName = "";
UpdateWindow();
}
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
else
{
errorMessage = null;
}
UpdateWindow();
}
void callback(object val)
{
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
mOperations[pair.Key] = pair.Value;
}
bool RenameGroup(string fromName, string toName)
{
BarChart barChart = (BarChart)serializedObject.targetObject;
try
{
barChart.DataSource.RenameGroup(fromName, toName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (barChart.gameObject.activeInHierarchy)
barChart.GenerateChart();
else
EditorUtility.SetDirty(barChart);
return true;
}
bool RenameCategory(string fromName,string toName)
{
BarChart barChart = (BarChart)serializedObject.targetObject;
try
{
barChart.DataSource.RenameCategory(fromName, toName);
}
catch(Exception)
{
return false;
}
serializedObject.Update();
if(barChart.gameObject.activeInHierarchy)
barChart.GenerateChart();
else
EditorUtility.SetDirty(barChart);
return true;
}
void RenameCalled(object val)
{
var data = (KeyValuePair<string, string>)val;
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
mRenameWindow = window;
if(data.Key == "category")
window.ShowDialog(data.Value, data.Key, RenameCategory);
else if(data.Key == "group")
window.ShowDialog(data.Value, data.Key, RenameGroup);
}
void DoContext(string type,string name)
{
string arg = type + "|" + name;
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Move Up"), false,callback, new KeyValuePair<string, string>(arg, "up"));
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
menu.ShowAsContext();
}
void UpdateWindow()
{
mUpdateWindow = true;
}
void OnDisable()
{
if(mRenameWindow != null)
{
mRenameWindow.Close();
mRenameWindow = null;
}
if (mWindow != null)
{
mWindow.Close();
mWindow = null;
}
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();
SerializedProperty barData = serializedObject.FindProperty("Data");
EditorGUILayout.BeginVertical();
Splitter();
if(mBold == null)
{
mBold = new GUIStyle(EditorStyles.foldout);
//mBold.fontStyle = FontStyle.Bold;
}
// EditorStyles.foldout.fontStyle = FontStyle.Bold;
// fold = EditorGUILayout.Foldout(fold,"Bar Data", EditorStyles.foldout);
//EditorStyles.foldout.fontStyle = FontStyle.Normal;
// if (fold)
// {
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
NamedItemEditor(barData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
NamedItemEditor(barData, "group", "mGroups", "Groups", ref mGroupError, ref mGroups, ref mNewGroupName);
SerializedProperty maxProp = barData.FindPropertyRelative("maxValue");
SerializedProperty minProp = barData.FindPropertyRelative("minValue");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(MinBarValue, EditorStyles.boldLabel);
SerializedProperty automaticProp = barData.FindPropertyRelative("automaticMinValue");
bool automatic = automaticProp.boolValue;
automatic = GUILayout.Toggle(automatic, "Auto");
GUILayout.FlexibleSpace();
automaticProp.boolValue = automatic;
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(minProp);
if (minProp.doubleValue > maxProp.doubleValue)
minProp.doubleValue = maxProp.doubleValue - 0.1;
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(MaxBarValue, EditorStyles.boldLabel);
automaticProp = barData.FindPropertyRelative("automaticMaxValue");
automatic = automaticProp.boolValue;
automatic = GUILayout.Toggle(automatic, "Auto");
GUILayout.FlexibleSpace();
automaticProp.boolValue = automatic;
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(maxProp);
if (minProp.doubleValue > maxProp.doubleValue)
maxProp.doubleValue = minProp.doubleValue + 0.1;
}
if (GUILayout.Button("Edit Values...") && mWindow == null)
mWindow = ChartDataEditor.ShowForObject(serializedObject);
//}
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
if (mUpdateWindow == true)
{
mUpdateWindow = false;
if (mWindow != null)
{
mWindow.SetEditedObject(serializedObject);
mWindow.Repaint();
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 056f0fff5e172de468df8c3392cabaac
timeCreated: 1473969758
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
[CustomPropertyDrawer(typeof(GraphDataFiller.CategoryData))]
class CategoryDataEditor : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return -2f;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
var enabled = property.FindPropertyRelative("Enabled");
property.isExpanded = EditorGUILayout.Foldout(property.isExpanded, property.displayName);
if(property.isExpanded)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(enabled);
if (enabled.boolValue == true)
{
var dataType = property.FindPropertyRelative("DataType");
EditorGUILayout.PropertyField(dataType);
int item = dataType.enumValueIndex;
var iterator = property.Copy();
var end = iterator.GetEndProperty();
bool hasNext = iterator.NextVisible(true);
Type t = typeof(GraphDataFiller.CategoryData);
while (hasNext)
{
if ((SerializedProperty.EqualContents(iterator, end)))
break;
bool show = false;
foreach (object attrb in t.GetField(iterator.name).GetCustomAttributes(false))
{
var cast = attrb as ChartFillerEditorAttribute;
if (cast != null)
{
if ((int)cast.ShowForType == item)
{
show = true;
break;
}
}
}
if (show)
EditorGUILayout.PropertyField(iterator);
// Debug.Log(iterator.displayName);
hasNext = iterator.NextVisible(false);
}
}
}
EditorGUI.indentLevel--;
EditorGUI.EndProperty();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d7ad20a161538c146aa76559c3f89754
timeCreated: 1536697084
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
namespace ChartAndGraph
{
[CustomEditor(typeof(CategoryLabels))]
class CategoryLabelsLabelsInspector : ItemLabelsBaseEditor
{
protected override string Name
{
get
{
return "category labels";
}
}
protected override bool isSupported(AnyChart chart)
{
return ((IInternalUse)chart).InternalSupportsCategoryLables;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 31ece195e6c596940a2dd7720c53058e
timeCreated: 1480254476
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,96 @@
#define Graph_And_Chart_PRO
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class ChartDataEditor : UnityEditor.EditorWindow
{
SerializedObject mEditedObject;
SerializedProperty mBarData;
SerializedProperty mCategories;
SerializedProperty mGroups;
SerializedProperty mData;
Dictionary<string, SerializedProperty> mValues;
public static ChartDataEditor ShowForObject(SerializedObject obj)
{
ChartDataEditor window = (ChartDataEditor)EditorWindow.GetWindow(typeof(ChartDataEditor));
window.SetEditedObject(obj);
return window;
}
public void SetEditedObject(SerializedObject obj)
{
mEditedObject = obj;
mBarData = mEditedObject.FindProperty("Data");
mCategories = mBarData.FindPropertyRelative("mCategories");
mGroups = mBarData.FindPropertyRelative("mGroups");
mData = mBarData.FindPropertyRelative("mData");
LoadData();
}
void LoadData()
{
if(mValues == null)
mValues = new Dictionary<string, SerializedProperty>();
mValues.Clear();
int size = mData.arraySize;
for (int i = 0; i < size; i++)
{
SerializedProperty prop = mData.GetArrayElementAtIndex(i);
string columnName = prop.FindPropertyRelative("ColumnName").stringValue;
string rowName = prop.FindPropertyRelative("GroupName").stringValue;
SerializedProperty amount = prop.FindPropertyRelative("Amount");
string keyName = getKey(columnName, rowName);
mValues[keyName] = amount;
}
}
string getKey(string column,string row)
{
return string.Format("{0}|{1}", column, row);
}
void OnGUI()
{
GUILayout.Label("Edit Values", EditorStyles.boldLabel);
GUILayout.BeginVertical();
int categoryCount = mCategories.arraySize;
int groupCount = mGroups.arraySize;
GUILayout.BeginHorizontal();
GUILayout.Label(" ",GUILayout.Width(EditorGUIUtility.fieldWidth));
for (int i = 0; i < groupCount; i++)
{
string group = mGroups.GetArrayElementAtIndex(i).stringValue;
GUILayout.Label(group, GUILayout.Width(EditorGUIUtility.fieldWidth));
}
GUILayout.EndHorizontal();
for (int i=0; i<categoryCount; i++)
{
SerializedProperty catProp = mCategories.GetArrayElementAtIndex(i);
string category = catProp.FindPropertyRelative("Name").stringValue;
GUILayout.BeginHorizontal();
GUILayout.Label(category, GUILayout.Width(EditorGUIUtility.fieldWidth));
for (int j=0; j<groupCount; j++)
{
string group = mGroups.GetArrayElementAtIndex(j).stringValue;
string keyName = getKey(category, group);
double value =0.0;
SerializedProperty prop;
if (mValues.TryGetValue(keyName, out prop))
value = prop.doubleValue;
else
prop = null;
double newVal = EditorGUILayout.DoubleField(value, GUILayout.Width(EditorGUIUtility.fieldWidth));
if(newVal != value)
prop.doubleValue = newVal;
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
mEditedObject.ApplyModifiedProperties();
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b917e1b2904ebf348a64f64b59a51908
timeCreated: 1474501984
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
class ChartEditorCommon
{
internal static bool IsAlphaNum(string str)
{
if (string.IsNullOrEmpty(str))
return false;
for (int i = 0; i < str.Length; i++)
{
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
return false;
}
return true;
}
internal static bool HasAttributeOfType(Type type, string fieldName, Type attributeType)
{
FieldInfo inf = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
if (inf == null)
return false;
object[] attrb = inf.GetCustomAttributes(attributeType, true);
if (attrb == null)
return false;
return attrb.Length > 0;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7fc5bc09e01eda34da606695525bf023
timeCreated: 1479124371
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,58 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using ChartAndGraph;
using UnityEngine;
[CustomPropertyDrawer(typeof(ChartOrientedSize))]
class ChartOrientedSizeInspector : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUIUtility.singleLineHeight * 2;
}
void DoField(SerializedProperty prop, string label, Rect position)
{
float size = GUI.skin.label.CalcSize(new GUIContent(label)).x;
Rect labelRect = new Rect(position.x, position.y, size, position.height);
Rect FieldRect = new Rect(labelRect.xMax, position.y, position.width - size, position.height);
EditorGUI.LabelField(labelRect, label);
float val = prop.floatValue;
EditorGUI.LabelField(labelRect, label);
float labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 5;
val = EditorGUI.FloatField(FieldRect, " ", val);
EditorGUIUtility.labelWidth = labelWidth;
prop.floatValue = val;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
label = EditorGUI.BeginProperty(position, label, property);
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
position = EditorGUI.IndentedRect(position);
float halfWidth = position.width *0.5f;
float y = position.y + EditorGUIUtility.singleLineHeight;
float height = position.height - EditorGUIUtility.singleLineHeight;
Rect breadthRect = new Rect(position.x, y, halfWidth, height);
Rect depthRect = new Rect(breadthRect.xMax, y, halfWidth, height);
int indent = EditorGUI.indentLevel;
EditorGUI.indentLevel=0;
SerializedProperty breadth = property.FindPropertyRelative("Breadth");
SerializedProperty depth = property.FindPropertyRelative("Depth");
DoField(breadth, "Breadth:", breadthRect);
DoField(depth, "Depth:", depthRect);
EditorGUI.indentLevel = indent;
// EditorGUILayout.EndVertical();
EditorGUI.EndProperty();
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6f48c9091dc0c084595117abe8222c22
timeCreated: 1473684701
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,60 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
partial class EditorMenu
{
private static void InstanciateWorldSpace(string path)
{
GameObject obj = Resources.Load<GameObject>(path);
// GameObject obj = AssetDatabase.LoadAssetAtPath<GameObject>(path);
GameObject newObj = (GameObject)GameObject.Instantiate(obj);
newObj.name = newObj.name.Replace("(Clone)", "");
Undo.RegisterCreatedObjectUndo(newObj, "Create Object");
}
[MenuItem("Tools/Charts/Radar/3D")]
public static void AddRadarChartWorldSpace()
{
InstanciateWorldSpace("MenuPrefabs/3DRadar");
}
[MenuItem("Tools/Charts/Bar/3D/Simple")]
public static void AddBarChartSimple3D()
{
InstanciateWorldSpace("MenuPrefabs/Bar3DSimple");
}
[MenuItem("Tools/Charts/Bar/3D/Multiple Groups")]
public static void AddBarChartMultiple3D()
{
InstanciateWorldSpace("MenuPrefabs/Bar3DMultiple");
}
[MenuItem("Tools/Charts/Torus/3D")]
public static void AddTorusChart3D()
{
InstanciateWorldSpace("MenuPrefabs/Torus3D");
}
[MenuItem("Tools/Charts/Pie/3D")]
public static void AddPieChart3D()
{
InstanciateWorldSpace("MenuPrefabs/Pie3D");
}
[MenuItem("Tools/Charts/Graph/3D")]
public static void AddGraph3D()
{
InstanciateWorldSpace("MenuPrefabs/3DGraph");
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 128e6b85597fded4f886f1f5aea62b53
timeCreated: 1560597478
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,113 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
partial class EditorMenu
{
private static void InstanciateCanvas(string path)
{
Canvas[] canvases = GameObject.FindObjectsOfType<Canvas>();
if (canvases == null || canvases.Length == 0)
{
EditorUtility.DisplayDialog("No canvas in scene", "Please add a canvas to the scene and try again", "Ok");
return;
}
Canvas canvas = null;
foreach(Canvas c in canvases)
{
if(c.transform.parent == null)
{
canvas = c;
break;
}
}
if (canvas == null)
{
EditorUtility.DisplayDialog("No canvas in scene", "Please add a canvas to the scene and try again", "Ok");
return;
}
GameObject obj = Resources.Load<GameObject>(path);
GameObject newObj = (GameObject)GameObject.Instantiate(obj);
newObj.transform.SetParent(canvas.transform,false);
newObj.name = newObj.name.Replace("(Clone)","");
Undo.RegisterCreatedObjectUndo(newObj, "Create Object");
}
[MenuItem("Tools/Charts/Clear All")]
public static void ClearChartGarbage()
{
ChartItem[] children = GameObject.FindObjectsOfType<ChartItem>();
for (int i = 0; i < children.Length; ++i)
{
if (children[i] != null)
{
ChartCommon.SafeDestroy(children[i].gameObject);
}
}
}
[MenuItem("Tools/Charts/Radar/Canvas")]
public static void AddRadarChartCanvas()
{
InstanciateCanvas("MenuPrefabs/2DRadar");
}
[MenuItem("Tools/Charts/Bar/Canvas/Simple")]
public static void AddBarChartSimpleCanvas()
{
InstanciateCanvas("MenuPrefabs/BarCanvasSimple");
}
[MenuItem("Tools/Charts/Bar/Canvas/Multiple Groups")]
public static void AddBarChartMultipleCanvas()
{
InstanciateCanvas("MenuPrefabs/BarCanvasMultiple");
}
[MenuItem("Tools/Charts/Torus/Canvas")]
public static void AddTorusChartCanvas()
{
InstanciateCanvas("MenuPrefabs/TorusCanvas");
}
[MenuItem("Tools/Charts/Pie/Canvas")]
public static void AddPieChartCanvas()
{
InstanciateCanvas("MenuPrefabs/PieCanvas");
}
[MenuItem("Tools/Charts/Graph/Canvas/Simple")]
public static void AddGraphSimple()
{
InstanciateCanvas("MenuPrefabs/GraphSimple");
}
[MenuItem("Tools/Charts/Graph/Canvas/Multiple")]
public static void AddGraphMultiple()
{
InstanciateCanvas("MenuPrefabs/GraphMultiple");
}
[MenuItem("Tools/Charts/Legend")]
public static void AddChartLegend()
{
InstanciateCanvas("MenuPrefabs/Legend");
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 57e0bbe359ea30c4d814819575d1a81d
timeCreated: 1481803595
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,399 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
[CustomEditor(typeof(GraphChartBase), true)]
class GraphChartInspector : Editor
{
string mEditedCategory = "";
bool mCategories = false;
string mCategoryError = null;
string mNewCategoryName = "";
GUIStyle mRedStyle;
GUIStyle mBold;
HashSet<string> mAllNames = new HashSet<string>();
GUIStyle mSplitter;
List<int> mToRemove = new List<int>();
List<int> mToUp = new List<int>();
Dictionary<string, string> mOperations = new Dictionary<string, string>();
Texture mSettings;
GraphDataEditor mWindow;
RenameWindow mRenameWindow = null;
public void OnEnable()
{
mRedStyle = new GUIStyle();
mRedStyle.normal.textColor = Color.red;
mSplitter = new GUIStyle();
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
mSplitter.stretchWidth = true;
mSplitter.margin = new RectOffset(0, 0, 7, 7);
}
public void Splitter()
{
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
if (Event.current.type == EventType.Repaint)
{
Color restoreColor = GUI.color;
GUI.color = new Color(0.5f, 0.5f, 0.5f);
mSplitter.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
private static bool IsAlphaNum(string str)
{
if (string.IsNullOrEmpty(str))
return false;
for (int i = 0; i < str.Length; i++)
{
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
return false;
}
return true;
}
private void DoOperations(SerializedProperty items, int size, string type)
{
mToRemove.Clear();
mToUp.Clear();
bool up = false;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
string arg = type + "|" + name;
string res = null;
if (up == true)
{
mToUp.Add(i);
up = false;
}
if (mOperations.TryGetValue(arg, out res))
{
if (res == "remove")
mToRemove.Add(i);
if (res == "up" && i > 0)
mToUp.Add(i);
if (res == "down")
up = true;
mOperations.Remove(arg);
}
}
for (int i = 0; i < mToRemove.Count; i++)
{
items.DeleteArrayElementAtIndex(mToRemove[i]);
}
for (int i = 0; i < mToUp.Count; i++)
{
int cur = mToUp[i];
items.MoveArrayElement(cur, cur - 1);
}
}
private void DataEditor(SerializedProperty data, string type, string property, string caption)
{
}
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
{
SerializedProperty items = data.FindPropertyRelative(property);
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
//bool up, down;
mAllNames.Clear();
int size = items.arraySize;
if (Event.current.type == EventType.Layout)
DoOperations(items, size, type);
size = items.arraySize;
if (items.isExpanded)
{
EditorGUI.indentLevel++;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
mAllNames.Add(name);
bool toogle = false;
EditorGUILayout.BeginHorizontal();
if (nameProp != null)
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
else
{
toogle = false;
EditorGUILayout.LabelField(name);
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("..."))
DoContext(type, name);
EditorGUILayout.EndHorizontal();
if (toogle)
{
EditorGUI.indentLevel++;
if (nameProp != null)
{
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (entry.name != "Name" && entry.name != "data")
{
if (entry.name == "ViewOrder")
continue;
if (target is GraphChart) // canvas graph chart
{
if ((entry.name == "LinePrefab") || (entry.name == "FillPrefab") || (entry.name == "DotPrefab") || (entry.name == "Depth"))
{
continue;
}
}
else
{
if ((entry.name == "LineHoverPrefab") || (entry.name == "PointHoverPrefab"))
continue;
}
EditorGUILayout.PropertyField(entry, true);
}
}
while (entry.Next(false) && SerializedProperty.EqualContents(entry, end) == false);
GUILayout.BeginHorizontal();
GUILayout.Space(EditorGUI.IndentedRect(EditorGUILayout.GetControlRect()).xMin);
if (GUILayout.Button("Edit Values..."))
{
mEditedCategory = name;
if (mWindow == null)
mWindow = GraphDataEditor.ShowForObject(serializedObject, mEditedCategory);
}
GUILayout.EndHorizontal();
}
}
EditorGUI.indentLevel--;
}
}
if (errorMessage != null)
EditorGUILayout.LabelField(errorMessage, mRedStyle);
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
EditorGUILayout.BeginHorizontal();
newName = EditorGUILayout.TextField(newName);
//GUILayout.Space(indentAdd.xMin);
if (GUILayout.Button("Add"))
{
bool error = false;
if (newName.Trim().Length == 0)
{
errorMessage = "Name can't be empty";
error = true;
}
else if (IsAlphaNum(newName) == false)
{
errorMessage = "Name conatins invalid characters";
error = true;
}
else if (mAllNames.Contains(newName))
{
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
error = true;
}
if (error == false)
{
errorMessage = null;
items.InsertArrayElementAtIndex(size);
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
if (newItemName == null)
newItem.stringValue = newName;
else
newItemName.stringValue = newName;
newName = "";
UpdateWindow();
}
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
else
{
errorMessage = null;
}
UpdateWindow();
}
void callback(object val)
{
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
mOperations[pair.Key] = pair.Value;
}
bool RenameCategory(string oldName, string newName)
{
GraphChartBase graph = (GraphChartBase)serializedObject.targetObject;
try
{
graph.DataSource.RenameCategory(oldName, newName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (graph.gameObject.activeInHierarchy)
graph.GenerateChart();
else
EditorUtility.SetDirty(graph);
return true;
}
void RenameCalled(object val)
{
var data = (KeyValuePair<string, string>)val;
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
mRenameWindow = window;
window.ShowDialog(data.Value, data.Key, RenameCategory);
}
void DoContext(string type, string name)
{
string arg = type + "|" + name;
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
menu.ShowAsContext();
}
void UpdateWindow()
{
}
void OnDisable()
{
if (mRenameWindow != null)
{
mRenameWindow.Close();
mRenameWindow = null;
}
if (mWindow != null)
{
mWindow.Close();
mWindow = null;
}
}
public override void OnInspectorGUI()
{
//serializedObject.Update();
DrawDefaultInspector();
SerializedProperty autoScrollHorizontally = serializedObject.FindProperty("autoScrollHorizontally");
SerializedProperty horizontalScrolling = serializedObject.FindProperty("horizontalScrolling");
SerializedProperty autoScrollVertically = serializedObject.FindProperty("autoScrollVertically");
SerializedProperty verticalScrolling = serializedObject.FindProperty("verticalScrolling");
// SerializedProperty scrollable = serializedObject.FindProperty("scrollable");
// EditorGUILayout.PropertyField(scrollable);
// if (scrollable.boolValue == true)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(autoScrollHorizontally);
if (autoScrollHorizontally.boolValue == false)
EditorGUILayout.PropertyField(horizontalScrolling);
EditorGUILayout.PropertyField(autoScrollVertically);
if (autoScrollVertically.boolValue == false)
EditorGUILayout.PropertyField(verticalScrolling);
EditorGUI.indentLevel--;
}
SerializedProperty graphData = serializedObject.FindProperty("Data");
EditorGUILayout.BeginVertical();
Splitter();
if (mBold == null)
mBold = new GUIStyle(EditorStyles.foldout);
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
NamedItemEditor(graphData, "category", "mSerializedData", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
EditorGUI.indentLevel--;
SerializedProperty horizontalOrigin = graphData.FindPropertyRelative("horizontalViewOrigin");
SerializedProperty horizontalSize = graphData.FindPropertyRelative("horizontalViewSize");
SerializedProperty automaticcHorizontaViewGap = graphData.FindPropertyRelative("automaticcHorizontaViewGap");
SerializedProperty verticalOrigin = graphData.FindPropertyRelative("verticalViewOrigin");
SerializedProperty verticalSize = graphData.FindPropertyRelative("verticalViewSize");
SerializedProperty automaticVerticalViewGap = graphData.FindPropertyRelative("automaticVerticalViewGap");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Horizontal View", EditorStyles.boldLabel);
SerializedProperty automaticProp = graphData.FindPropertyRelative("automaticHorizontalView");
EditorGUILayout.PropertyField(automaticProp, new GUIContent("Auto"));
bool automatic = automaticProp.boolValue;
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(horizontalOrigin);
EditorGUILayout.PropertyField(horizontalSize);
// if (horizontalSize.doubleValue < 0.0)
// horizontalSize.doubleValue = 0.0001;
}
else
{
EditorGUILayout.PropertyField(automaticcHorizontaViewGap, new GUIContent("Horizontal Gap"));
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Vertical View", EditorStyles.boldLabel);
automaticProp = graphData.FindPropertyRelative("automaticVerticallView");
EditorGUILayout.PropertyField(automaticProp, new GUIContent("Auto"));
automatic = automaticProp.boolValue;
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(verticalOrigin);
EditorGUILayout.PropertyField(verticalSize);
// if (verticalSize.doubleValue < 0.0)
// verticalSize.doubleValue = 0.0001;
}
else
{
EditorGUILayout.PropertyField(automaticVerticalViewGap, new GUIContent("Vertical Gap"));
}
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
if (mWindow != null)
{
mWindow.SetEditedObject(serializedObject, mEditedCategory);
mWindow.Repaint();
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8671bd55b44fd0d46ad162bc055df077
timeCreated: 1480533379
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,98 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
class GraphDataEditor : UnityEditor.EditorWindow
{
SerializedObject mThisObject;
SerializedObject mEditedObject;
string category;
SerializedProperty mGraphData;
SerializedProperty mCategories;
SerializedProperty mCategory;
Dictionary<string, SerializedProperty> mValues;
SerializedObject mObject;
[SerializeField]
Vector2[] Data;
public static GraphDataEditor ShowForObject(SerializedObject obj,string category)
{
GraphDataEditor window = (GraphDataEditor)EditorWindow.GetWindow(typeof(GraphDataEditor));
window.SetEditedObject(obj, category);
return window;
}
int FindCategoryIndex(string category)
{
for(int i=0; i<mCategories.arraySize; i++)
{
string name = mCategories.GetArrayElementAtIndex(i).FindPropertyRelative("Name").stringValue;
if (name == category)
return i;
}
return -1;
}
public void SetEditedObject(SerializedObject obj,string categoryName)
{
category = categoryName;
mEditedObject = obj;
mGraphData = mEditedObject.FindProperty("Data");
mCategories = mGraphData.FindPropertyRelative("mSerializedData");
// LoadData();
int catIndex = FindCategoryIndex(categoryName);
if (catIndex == -1)
{
mCategory = null;
return;
}
mCategory = mCategories.GetArrayElementAtIndex(catIndex);
var arr = mCategory.FindPropertyRelative("InitialData");
mThisObject = new SerializedObject(this);
SerializedProperty serialProp = mThisObject.FindProperty("Data");
SetArray(arr, serialProp);
}
string getKey(string column, string row)
{
return string.Format("{0}|{1}", column, row);
}
void ShowCategoryArray()
{
}
void SetArray(SerializedProperty from,SerializedProperty to)
{
to.arraySize = from.arraySize;
for (int i = 0; i < from.arraySize; i++)
{
Vector2 val = from.GetArrayElementAtIndex(i).vector2Value;
to.GetArrayElementAtIndex(i).vector2Value = val;
}
}
void OnGUI()
{
SerializedProperty serialProp = mThisObject.FindProperty("Data");
GUILayout.Label("Edit Values - " + category, EditorStyles.boldLabel);
if (mCategory == null)
return;
EditorGUILayout.PropertyField(serialProp, true);
var arr = mCategory.FindPropertyRelative("InitialData");
if (mThisObject.ApplyModifiedProperties())
SetArray(serialProp,arr);
mEditedObject.ApplyModifiedProperties();
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 03f0eb5ac4118424f8d68f32ef5ffa1b
timeCreated: 1584550686
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
namespace ChartAndGraph
{
[CustomEditor(typeof(GraphDataFiller), true)]
class GraphDataFillerEditor : Editor
{
/*
*
*
*
*
*
* This is a work around and must not be deleteed
*
*
*
*
*
* */
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
// var cats = serializedObject.FindProperty("Categories");
// EditorGUILayout.PropertyField(cats);
// CategoryDataEditor
// Categories
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 05791da4c4a2fc44281046536e32e237
timeCreated: 1560715350
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
namespace ChartAndGraph
{
[CustomEditor(typeof(GroupLabels))]
class GroupLabelsInspector : ItemLabelsBaseEditor
{
protected override string Name
{
get
{
return "group labels";
}
}
protected override bool isSupported(AnyChart chart)
{
return ((IInternalUse)chart).InternalSupportsGroupLabels;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1a56a06b898a879418ba574600eaf84a
timeCreated: 1480254476
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,35 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
namespace ChartAndGraph
{
abstract class ItemLabelsBaseEditor : Editor
{
protected abstract string Name { get; }
protected abstract bool isSupported(AnyChart chart);
public override void OnInspectorGUI()
{
ItemLabelsBase labels = (ItemLabelsBase)target;
if (labels.gameObject == null)
return;
AnyChart chart = labels.gameObject.GetComponent<AnyChart>();
if (chart == null)
return;
if (isSupported(chart) == false)
{
EditorGUILayout.HelpBox(string.Format("Chart of type {0} does not support {1}", chart.GetType().Name,Name),MessageType.Warning);
return;
}
base.OnInspectorGUI();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 67d1379f880dde846adec8a6157669d1
timeCreated: 1480254476
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
namespace ChartAndGraph
{
[CustomEditor(typeof(ItemLabels))]
class ItemLabelsLabelsInspector : ItemLabelsBaseEditor
{
protected override string Name
{
get
{
return "item labels";
}
}
protected override bool isSupported(AnyChart chart)
{
return ((IInternalUse)chart).InternalSupportsItemLabels;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 12cb0562684057a448410b90a0e565f8
timeCreated: 1480254476
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
[CustomPropertyDrawer(typeof(MaterialTiling))]
class MaterialTilingInspector : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
label = EditorGUI.BeginProperty(position, label, property);
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
SerializedProperty auto = property.FindPropertyRelative("EnableTiling");
SerializedProperty val = property.FindPropertyRelative("TileFactor");
int indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
bool res = !EditorGUI.ToggleLeft(position,"Stretch", !auto.boolValue);
EditorGUI.indentLevel = indent;
//EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel++;
if (auto.boolValue == true && EditorGUI.showMixedValue == false)
{
EditorGUILayout.HelpBox("Remember to enable texture repeat mode in order to make tiling work !",MessageType.Warning,true);
EditorGUILayout.HelpBox("For the best results on canvas , set the tiling factor to the pixel size of the textre", MessageType.Info, true);
val.floatValue = EditorGUILayout.FloatField("Tiling Factor",val.floatValue);
if (val.floatValue <= 0f)
val.floatValue = 0.01f;
}
auto.boolValue = res;
EditorGUI.indentLevel--;
EditorGUI.EndProperty();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7c894d939d8cec94fa27b4e6b437e6bc
timeCreated: 1479370450
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,326 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(PieChart), true)]
class PieChartInspetor : Editor
{
bool mCategories = false;
string mCategoryError = null;
string mNewCategoryName = "";
GUIStyle mRedStyle;
GUIStyle mBold;
HashSet<string> mAllNames = new HashSet<string>();
GUIStyle mSplitter;
List<int> mToRemove = new List<int>();
List<int> mToUp = new List<int>();
Dictionary<string, string> mOperations = new Dictionary<string, string>();
ChartDataEditor mWindow;
bool mUpdateWindow = false;
Texture mSettings;
RenameWindow mRenameWindow = null;
public void OnEnable()
{
mRedStyle = new GUIStyle();
mRedStyle.normal.textColor = Color.red;
mSplitter = new GUIStyle();
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
mSplitter.stretchWidth = true;
mSplitter.margin = new RectOffset(0, 0, 7, 7);
}
public void Splitter()
{
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
if (Event.current.type == EventType.Repaint)
{
Color restoreColor = GUI.color;
GUI.color = new Color(0.5f, 0.5f, 0.5f);
mSplitter.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
private static bool IsAlphaNum(string str)
{
if (string.IsNullOrEmpty(str))
return false;
for (int i = 0; i < str.Length; i++)
{
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
return false;
}
return true;
}
private void DoOperations(SerializedProperty items, int size, string type)
{
mToRemove.Clear();
mToUp.Clear();
bool up = false;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
string arg = type + "|" + name;
string res = null;
if (up == true)
{
mToUp.Add(i);
up = false;
}
if (mOperations.TryGetValue(arg, out res))
{
if (res == "remove")
mToRemove.Add(i);
if (res == "up" && i > 0)
mToUp.Add(i);
if (res == "down")
up = true;
mOperations.Remove(arg);
}
}
for (int i = 0; i < mToRemove.Count; i++)
items.DeleteArrayElementAtIndex(mToRemove[i]);
for (int i = 0; i < mToUp.Count; i++)
{
int cur = mToUp[i];
items.MoveArrayElement(cur, cur - 1);
}
}
private SerializedProperty getArrayCategory(SerializedProperty arr, string name)
{
for (int i = 0; i < arr.arraySize; i++)
{
SerializedProperty prop = arr.GetArrayElementAtIndex(i);
if (prop.FindPropertyRelative("ColumnName").stringValue == name)
return prop.FindPropertyRelative("Amount");
}
return null;
}
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
{
SerializedProperty items = data.FindPropertyRelative(property);
SerializedProperty dataValues = data.FindPropertyRelative("mData");
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
//bool up, down;
mAllNames.Clear();
int size = items.arraySize;
if (Event.current.type == EventType.Layout)
DoOperations(items, size, type);
size = items.arraySize;
if (items.isExpanded)
{
EditorGUI.indentLevel++;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
mAllNames.Add(name);
bool toogle = false;
EditorGUILayout.BeginHorizontal();
if (nameProp != null)
toogle = entry.isExpanded =EditorGUILayout.Foldout(entry.isExpanded, name);
else
{
toogle = false;
EditorGUILayout.LabelField(name);
}
SerializedProperty valueProp = getArrayCategory(dataValues, name);
GUILayout.FlexibleSpace();
if(valueProp != null)
EditorGUILayout.PropertyField(valueProp);
if (GUILayout.Button("..."))
DoContext(type, name);
EditorGUILayout.EndHorizontal();
if (toogle)
{
EditorGUI.indentLevel++;
if (nameProp != null)
{
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (entry.name != "Name")
EditorGUILayout.PropertyField(entry, true);
}
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
}
}
EditorGUI.indentLevel--;
}
}
if (errorMessage != null)
EditorGUILayout.LabelField(errorMessage, mRedStyle);
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
EditorGUILayout.BeginHorizontal();
newName = EditorGUILayout.TextField(newName);
//GUILayout.Space(indentAdd.xMin);
if (GUILayout.Button("Add"))
{
bool error = false;
if (newName.Trim().Length == 0)
{
errorMessage = "Name can't be empty";
error = true;
}
else if (IsAlphaNum(newName) == false)
{
errorMessage = "Name conatins invalid characters";
error = true;
}
else if (mAllNames.Contains(newName))
{
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
error = true;
}
if (error == false)
{
errorMessage = null;
items.InsertArrayElementAtIndex(size);
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
if (newItemName == null)
newItem.stringValue = newName;
else
newItemName.stringValue = newName;
newName = "";
UpdateWindow();
}
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
else
{
errorMessage = null;
}
UpdateWindow();
}
void callback(object val)
{
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
mOperations[pair.Key] = pair.Value;
}
bool RenameCategory(string fromName, string toName)
{
PieChart pieChart = (PieChart)serializedObject.targetObject;
try
{
pieChart.DataSource.RenameCategory(fromName, toName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (pieChart.gameObject.activeInHierarchy)
pieChart.GenerateChart();
else
EditorUtility.SetDirty(pieChart);
return true;
}
void RenameCalled(object val)
{
var data = (KeyValuePair<string, string>)val;
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
mRenameWindow = window;
if (data.Key == "category")
window.ShowDialog(data.Value, data.Key, RenameCategory);
}
void DoContext(string type, string name)
{
string arg = type + "|" + name;
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
menu.ShowAsContext();
}
void UpdateWindow()
{
mUpdateWindow = true;
}
void OnDisable()
{
if(mRenameWindow != null)
{
mRenameWindow.Close();
mRenameWindow = null;
}
if (mWindow != null)
{
mWindow.Close();
mWindow = null;
}
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();
SerializedProperty barData = serializedObject.FindProperty("Data");
EditorGUILayout.BeginVertical();
Splitter();
if (mBold == null)
mBold = new GUIStyle(EditorStyles.foldout);
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
NamedItemEditor(barData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
if (mUpdateWindow == true)
{
mUpdateWindow = false;
if (mWindow != null)
{
mWindow.SetEditedObject(serializedObject);
mWindow.Repaint();
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dcc024b6935dfff44aece802ded95e9a
timeCreated: 1480008753
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8ef85873de9c3f742b12f175025aed9a
folderAsset: yes
timeCreated: 1539558023
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,71 @@
#define Graph_And_Chart_PRO
#if PLAYMAKER
using UnityEngine;
using UnityEditor;
using HutongGames.PlayMaker.Actions;
using HutongGames.PlayMakerEditor;
[CustomActionEditor(typeof(AppendGraphPointAction))]
public class CustomActionEditorTest : CustomActionEditor
{
enum DateOrNumeric
{
Numeric,
Date
}
public override void OnEnable()
{
// Do any expensive initialization stuff here.
// This is called when the editor is created.
}
public override bool OnGUI()
{
var action = target as AppendGraphPointAction;
EditField("ChartObject");
EditField("CategoryName");
EditField("AnimationTime");
EditField("DateTimeKind");
EditField("PointSize");
EditorGUILayout.LabelField("X value:");
DateOrNumeric type = DateOrNumeric.Numeric;
if (action.XValueIsDate)
type = DateOrNumeric.Date;
type = (DateOrNumeric)EditorGUILayout.EnumPopup("type", type);
action.XValueIsDate = type == DateOrNumeric.Date;
if (action.XValueIsDate)
{
EditField("XDateYear");
EditField("XDateMonth");
EditField("XDateDay");
EditField("XDateHour");
EditField("XDateMinute");
EditField("XDateSecond");
}
else
EditField("XValueFloat");
EditorGUILayout.LabelField("Y value:");
type = DateOrNumeric.Numeric;
if (action.YValueIsDate)
type = DateOrNumeric.Date;
type = (DateOrNumeric)EditorGUILayout.EnumPopup("type", type);
action.YValueIsDate = type == DateOrNumeric.Date;
if (action.YValueIsDate)
{
EditField("YDateYear");
EditField("YDateMonth");
EditField("YDateDay");
EditField("YDateHour");
EditField("YDateMinute");
EditField("YDateSecond");
}
else
EditField("YValueFloat");
return GUI.changed;
}
}
#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99d21976d8cc674488ca0e4bffe806f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,83 @@
#define Graph_And_Chart_PRO
#if UNITY_2018_3_OR_NEWER
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
using ChartAndGraph;
public class PrefabOverrideChart : UnityEditor.AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
foreach (string path in importedAssets)
{
string lowPath = path.ToLower();
if (lowPath.EndsWith(".prefab"))
{
if (ContainsPath(lowPath) == false)
{
// Debug.Log(lowPath);
EditorApplication.delayCall += () => CleanPrefab(path);
AddPath(lowPath);
}
}
}
foreach (string path in deletedAssets)
{
RemovePath(path.ToLower());
}
}
[MenuItem("EditorPrefs/Clear all Editor Preferences")]
static void deleteAllExample()
{
EditorPrefs.DeleteAll();
}
static bool ContainsPath(string path)
{
return EditorPrefs.GetBool("GraphAndChartPrefabOverride$" + path, false);
}
static void RemovePath(string path)
{
EditorPrefs.DeleteKey("GraphAndChartPrefabOverride$" + path);
}
static void AddPath(string path)
{
EditorPrefs.SetBool("GraphAndChartPrefabOverride$" + path, true);
}
static void CleanPrefab(string path)
{
GameObject obj = PrefabUtility.LoadPrefabContents(path);
//AssetDatabase.DeleteAsset(path);
bool savePrefab = false;
foreach (var item in obj.GetComponentsInChildren<AnyChart>(true))
{
savePrefab = true;
// if (item == null)
// continue;
// if (item.gameObject == null)
// continue;
// Debug.Log("destroy " + item.gameObject.name);
while (item.gameObject.transform.childCount > 0)
{
var innerObj = item.gameObject.transform.GetChild(0).gameObject;
if (innerObj != null)
{
// Debug.Log("destroy inner" + innerObj.name);
GameObject.DestroyImmediate(innerObj);
}
}
}
if (savePrefab)
PrefabUtility.SaveAsPrefabAsset(obj, path);
PrefabUtility.UnloadPrefabContents(obj);
}
}
#endif
#endif

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: eb3ccf7dc2806314e99c1bbc160aabec
timeCreated: 1579105195
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,375 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace Assets
{
[CustomEditor(typeof(RadarChart), true)]
class RadarChartInspector : UnityEditor.Editor
{
bool mCategories = false;
bool mGroups = false;
string mCategoryError = null;
string mNewCategoryName = "";
string mNewGroupName = "";
string mGroupError = null;
GUIStyle mRedStyle;
GUIStyle mBold;
HashSet<string> mAllNames = new HashSet<string>();
GUIStyle mSplitter;
List<int> mToRemove = new List<int>();
List<int> mToUp = new List<int>();
Dictionary<string, string> mOperations = new Dictionary<string, string>();
ChartDataEditor mWindow;
bool mUpdateWindow = false;
Texture mSettings;
GUIContent MaxRadarValue = new GUIContent("Max Value :", "All radar values are scale according to this value");
RenameWindow mRenameWindow;
string[] NonCanvas = new string[]
{
"LinePrefab",
"PointPrefab",
"Seperation",
"Curve",
"FillSmoothing"
};
public void OnEnable()
{
mRedStyle = new GUIStyle();
mRedStyle.normal.textColor = Color.red;
mSplitter = new GUIStyle();
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
mSplitter.stretchWidth = true;
mSplitter.margin = new RectOffset(0, 0, 7, 7);
}
public void Splitter()
{
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
if (Event.current.type == EventType.Repaint)
{
Color restoreColor = GUI.color;
GUI.color = new Color(0.5f, 0.5f, 0.5f);
mSplitter.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
private void DoOperations(SerializedProperty items, int size, string type)
{
mToRemove.Clear();
mToUp.Clear();
bool up = false;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
string arg = type + "|" + name;
string res = null;
if (up == true)
{
mToUp.Add(i);
up = false;
}
if (mOperations.TryGetValue(arg, out res))
{
if (res == "remove")
mToRemove.Add(i);
if (res == "up" && i > 0)
mToUp.Add(i);
if (res == "down")
up = true;
mOperations.Remove(arg);
}
}
for (int i = 0; i < mToRemove.Count; i++)
items.DeleteArrayElementAtIndex(mToRemove[i]);
for (int i = 0; i < mToUp.Count; i++)
{
int cur = mToUp[i];
items.MoveArrayElement(cur, cur - 1);
}
}
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
{
SerializedProperty items = data.FindPropertyRelative(property);
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
//bool up, down;
mAllNames.Clear();
int size = items.arraySize;
if (Event.current.type == EventType.Layout)
DoOperations(items, size, type);
size = items.arraySize;
if (items.isExpanded)
{
EditorGUI.indentLevel++;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
mAllNames.Add(name);
EditorGUILayout.BeginHorizontal();
bool toogle = false;
if (nameProp != null)
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
else
{
toogle = false;
EditorGUILayout.LabelField(name);
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("..."))
DoContext(type, name);
EditorGUILayout.EndHorizontal();
if (toogle)
{
EditorGUI.indentLevel++;
if (nameProp != null)
{
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (entry.name != "Name")
{
if(target is CanvasRadarChart)
{
if (NonCanvas.Contains(entry.name))
continue;
}
else
{
if (entry.name == "LineHover" || entry.name == "PointHover")
continue;
}
EditorGUILayout.PropertyField(entry, true);
}
}
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
}
}
EditorGUI.indentLevel--;
}
}
if (errorMessage != null)
EditorGUILayout.LabelField(errorMessage, mRedStyle);
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
EditorGUILayout.BeginHorizontal();
newName = EditorGUILayout.TextField(newName);
//GUILayout.Space(indentAdd.xMin);
if (GUILayout.Button("Add"))
{
bool error = false;
if (newName.Trim().Length == 0)
{
errorMessage = "Name can't be empty";
error = true;
}
else if (ChartEditorCommon.IsAlphaNum(newName) == false)
{
errorMessage = "Name conatins invalid characters";
error = true;
}
else if (mAllNames.Contains(newName))
{
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
error = true;
}
if (error == false)
{
errorMessage = null;
items.InsertArrayElementAtIndex(size);
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
if (newItemName == null)
newItem.stringValue = newName;
else
newItemName.stringValue = newName;
newName = "";
UpdateWindow();
}
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
else
{
errorMessage = null;
}
UpdateWindow();
}
void callback(object val)
{
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
mOperations[pair.Key] = pair.Value;
}
bool RenameGroup(string fromName, string toName)
{
RadarChart radarChart = (RadarChart)serializedObject.targetObject;
try
{
radarChart.DataSource.RenameGroup(fromName, toName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (radarChart.gameObject.activeInHierarchy)
radarChart.GenerateChart();
else
EditorUtility.SetDirty(radarChart);
return true;
}
bool RenameCategory(string fromName, string toName)
{
RadarChart radarChart = (RadarChart)serializedObject.targetObject;
try
{
radarChart.DataSource.RenameCategory(fromName, toName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (radarChart.gameObject.activeInHierarchy)
radarChart.GenerateChart();
else
EditorUtility.SetDirty(radarChart);
return true;
}
void RenameCalled(object val)
{
var data = (KeyValuePair<string, string>)val;
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
mRenameWindow = window;
if (data.Key == "category")
window.ShowDialog(data.Value, data.Key, RenameCategory);
else if (data.Key == "group")
window.ShowDialog(data.Value, data.Key, RenameGroup);
}
void DoContext(string type, string name)
{
string arg = type + "|" + name;
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
menu.ShowAsContext();
}
void UpdateWindow()
{
mUpdateWindow = true;
}
void OnDisable()
{
if (mRenameWindow != null)
{
mRenameWindow.Close();
mRenameWindow = null;
}
if (mWindow != null)
{
mWindow.Close();
mWindow = null;
}
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
serializedObject.Update();
SerializedProperty radarData = serializedObject.FindProperty("Data");
EditorGUILayout.BeginVertical();
Splitter();
if (mBold == null)
{
mBold = new GUIStyle(EditorStyles.foldout);
}
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
NamedItemEditor(radarData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
NamedItemEditor(radarData, "group", "mGroups", "Groups", ref mGroupError, ref mGroups, ref mNewGroupName);
SerializedProperty maxProp = radarData.FindPropertyRelative("maxValue");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(MaxRadarValue, EditorStyles.boldLabel);
SerializedProperty automaticProp = radarData.FindPropertyRelative("automaticMaxValue");
bool automatic = automaticProp.boolValue;
automatic = GUILayout.Toggle(automatic, "Auto");
GUILayout.FlexibleSpace();
automaticProp.boolValue = automatic;
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(maxProp);
if (0f > maxProp.doubleValue)
maxProp.doubleValue = 0.001f;
}
if (GUILayout.Button("Edit Values...") && mWindow == null)
mWindow = ChartDataEditor.ShowForObject(serializedObject);
//}
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
if (mUpdateWindow == true)
{
mUpdateWindow = false;
if (mWindow != null)
{
mWindow.SetEditedObject(serializedObject);
mWindow.Repaint();
}
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ec3a557017cfb7040b5a426cb7f71a47
timeCreated: 1489858254
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,71 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
class RenameWindow :EditorWindow
{
string mStartName;
string mValue = "";
string mType;
Func<string, string, bool> mRenameMethod;
string mMessage = null;
public void ShowDialog(string currentName,string type,Func<string,string, bool> renameMethod)
{
mStartName = currentName;
mValue = currentName;
mType = type;
mRenameMethod = renameMethod;
float height = (float)(EditorGUIUtility.singleLineHeight * 6f);
minSize = maxSize = new Vector2(300, height);
Show();
}
void OnGUI()
{
EditorGUILayout.LabelField(string.Format("Select a new {0} name",mType));
mValue = EditorGUILayout.TextField(mValue);
bool disabled = false;
if (mValue.Trim().Length == 0)
{
mMessage = null;
EditorGUILayout.LabelField("Name can't be empty");
disabled = true;
}
else
if (ChartEditorCommon.IsAlphaNum(mValue) == false)
{
mMessage = null;
EditorGUILayout.LabelField("Name contains invalid charecters");
disabled = true;
}
if (mMessage != null)
EditorGUILayout.LabelField(mMessage);
EditorGUILayout.BeginHorizontal();
GUI.enabled = !disabled;
if (GUILayout.Button("Rename"))
{
if (mStartName == mValue)
Close();
else
{
if (mRenameMethod(mStartName,mValue))
Close();
else
mMessage = string.Format("A {0} by the name {1} already exists", mType, mValue);
}
}
GUI.enabled = true;
GUILayout.FlexibleSpace();
if (GUILayout.Button("Cancel"))
Close();
EditorGUILayout.EndHorizontal();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 66d4769f533803d49a88420cd97553f9
timeCreated: 1481046854
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3203417d7436b60468e85cdd312a55cf
folderAsset: yes
timeCreated: 1559401944
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 32578c1a672aa5c44bdd3d005e4adff1
folderAsset: yes
timeCreated: 1505898578
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,408 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace ChartAndGraph
{
[CustomEditor(typeof(CandleChart), true)]
class CandleChartInspector : Editor
{
bool mCategories = false;
string mCategoryError = null;
string mNewCategoryName = "";
GUIStyle mRedStyle;
GUIStyle mBold;
HashSet<string> mAllNames = new HashSet<string>();
GUIStyle mSplitter;
List<int> mToRemove = new List<int>();
List<int> mToUp = new List<int>();
Dictionary<string, string> mOperations = new Dictionary<string, string>();
ChartDataEditor mWindow;
Texture mSettings;
RenameWindow mRenameWindow = null;
public void OnEnable()
{
mRedStyle = new GUIStyle();
mRedStyle.normal.textColor = Color.red;
mSplitter = new GUIStyle();
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
mSplitter.stretchWidth = true;
mSplitter.margin = new RectOffset(0, 0, 7, 7);
}
public void Splitter()
{
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
if (Event.current.type == EventType.Repaint)
{
Color restoreColor = GUI.color;
GUI.color = new Color(0.5f, 0.5f, 0.5f);
mSplitter.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
private static bool IsAlphaNum(string str)
{
if (string.IsNullOrEmpty(str))
return false;
for (int i = 0; i < str.Length; i++)
{
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
return false;
}
return true;
}
private void DoOperations(SerializedProperty items, int size, string type)
{
mToRemove.Clear();
mToUp.Clear();
bool up = false;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
string arg = type + "|" + name;
string res = null;
if (up == true)
{
mToUp.Add(i);
up = false;
}
if (mOperations.TryGetValue(arg, out res))
{
if (res == "remove")
mToRemove.Add(i);
if (res == "up" && i > 0)
mToUp.Add(i);
if (res == "down")
up = true;
mOperations.Remove(arg);
}
}
for (int i = 0; i < mToRemove.Count; i++)
{
items.DeleteArrayElementAtIndex(mToRemove[i]);
}
for (int i = 0; i < mToUp.Count; i++)
{
int cur = mToUp[i];
items.MoveArrayElement(cur, cur - 1);
}
}
private void CandleSettings(SerializedProperty item)
{
SerializedProperty entry = item.Copy();
EditorGUILayout.LabelField(entry.name);
EditorGUI.indentLevel++;
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (target is CandleChart) // canvas graph chart
{
if ((entry.name == "CandlePrefab"))
{
continue;
}
}
else
{
if (entry.name == "CandleHoverPrefab")
continue;
}
EditorGUILayout.PropertyField(entry, true);
}
while (entry.Next(false) && SerializedProperty.EqualContents(entry, end) == false);
}
EditorGUI.indentLevel--;
}
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
{
SerializedProperty items = data.FindPropertyRelative(property);
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
//bool up, down;
mAllNames.Clear();
int size = items.arraySize;
if (Event.current.type == EventType.Layout)
DoOperations(items, size, type);
size = items.arraySize;
if (items.isExpanded)
{
EditorGUI.indentLevel++;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
mAllNames.Add(name);
bool toogle = false;
EditorGUILayout.BeginHorizontal();
if (nameProp != null)
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
else
{
toogle = false;
EditorGUILayout.LabelField(name);
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("..."))
DoContext(type, name);
EditorGUILayout.EndHorizontal();
if (toogle)
{
EditorGUI.indentLevel++;
if (nameProp != null)
{
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (entry.name != "Name" && entry.name != "Data")
{
if (target is CandleChart) // canvas graph chart
{
if ((entry.name == "LinePrefab") || (entry.name == "FillPrefab") || (entry.name == "DotPrefab") || (entry.name == "Depth"))
{
continue;
}
}
else
{
if ((entry.name == "LineHoverPrefab") || (entry.name == "PointHoverPrefab"))
continue;
}
if (entry.name == "UpCandle" || entry.name == "DownCandle")
CandleSettings(entry);
else
EditorGUILayout.PropertyField(entry, true);
}
}
while (entry.Next(false) && SerializedProperty.EqualContents(entry, end) == false);
}
}
EditorGUI.indentLevel--;
}
}
if (errorMessage != null)
EditorGUILayout.LabelField(errorMessage, mRedStyle);
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
EditorGUILayout.BeginHorizontal();
newName = EditorGUILayout.TextField(newName);
//GUILayout.Space(indentAdd.xMin);
if (GUILayout.Button("Add"))
{
bool error = false;
if (newName.Trim().Length == 0)
{
errorMessage = "Name can't be empty";
error = true;
}
else if (IsAlphaNum(newName) == false)
{
errorMessage = "Name conatins invalid characters";
error = true;
}
else if (mAllNames.Contains(newName))
{
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
error = true;
}
if (error == false)
{
errorMessage = null;
items.InsertArrayElementAtIndex(size);
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
if (newItemName == null)
newItem.stringValue = newName;
else
newItemName.stringValue = newName;
newName = "";
UpdateWindow();
}
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
else
{
errorMessage = null;
}
UpdateWindow();
}
void callback(object val)
{
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
mOperations[pair.Key] = pair.Value;
}
bool RenameCategory(string oldName, string newName)
{
CandleChart graph = (CandleChart)serializedObject.targetObject;
try
{
graph.DataSource.RenameCategory(oldName, newName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (graph.gameObject.activeInHierarchy)
graph.GenerateChart();
else
EditorUtility.SetDirty(graph);
return true;
}
void RenameCalled(object val)
{
var data = (KeyValuePair<string, string>)val;
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
mRenameWindow = window;
window.ShowDialog(data.Value, data.Key, RenameCategory);
}
void DoContext(string type, string name)
{
string arg = type + "|" + name;
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
menu.ShowAsContext();
}
void UpdateWindow()
{
}
void OnDisable()
{
if (mRenameWindow != null)
{
mRenameWindow.Close();
mRenameWindow = null;
}
if (mWindow != null)
{
mWindow.Close();
mWindow = null;
}
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
SerializedProperty autoScrollHorizontally = serializedObject.FindProperty("autoScrollHorizontally");
SerializedProperty horizontalScrolling = serializedObject.FindProperty("horizontalScrolling");
SerializedProperty autoScrollVertically = serializedObject.FindProperty("autoScrollVertically");
SerializedProperty verticalScrolling = serializedObject.FindProperty("verticalScrolling");
// SerializedProperty scrollable = serializedObject.FindProperty("scrollable");
// EditorGUILayout.PropertyField(scrollable);
// if (scrollable.boolValue == true)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(autoScrollHorizontally);
if (autoScrollHorizontally.boolValue == false)
EditorGUILayout.PropertyField(horizontalScrolling);
EditorGUILayout.PropertyField(autoScrollVertically);
if (autoScrollVertically.boolValue == false)
EditorGUILayout.PropertyField(verticalScrolling);
EditorGUI.indentLevel--;
}
SerializedProperty graphData = serializedObject.FindProperty("Data");
EditorGUILayout.BeginVertical();
Splitter();
if (mBold == null)
mBold = new GUIStyle(EditorStyles.foldout);
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
NamedItemEditor(graphData, "category", "mSerializedData", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
EditorGUI.indentLevel--;
SerializedProperty horizontalOrigin = graphData.FindPropertyRelative("horizontalViewOrigin");
SerializedProperty horizontalSize = graphData.FindPropertyRelative("horizontalViewSize");
SerializedProperty automaticcHorizontaViewGap = graphData.FindPropertyRelative("automaticcHorizontaViewGap");
SerializedProperty verticalOrigin = graphData.FindPropertyRelative("verticalViewOrigin");
SerializedProperty verticalSize = graphData.FindPropertyRelative("verticalViewSize");
SerializedProperty automaticVerticalViewGap = graphData.FindPropertyRelative("automaticVerticalViewGap");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Horizontal View", EditorStyles.boldLabel);
SerializedProperty automaticProp = graphData.FindPropertyRelative("automaticHorizontalView");
bool automatic = automaticProp.boolValue;
automatic = GUILayout.Toggle(automatic, "Auto");
GUILayout.FlexibleSpace();
automaticProp.boolValue = automatic;
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(horizontalOrigin);
EditorGUILayout.PropertyField(horizontalSize);
// if (horizontalSize.doubleValue < 0.0)
// horizontalSize.doubleValue = 0.0001;
}
else
{
EditorGUILayout.PropertyField(automaticcHorizontaViewGap, new GUIContent("Horizontal Gap"));
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Vertical View", EditorStyles.boldLabel);
automaticProp = graphData.FindPropertyRelative("automaticVerticallView");
automatic = automaticProp.boolValue;
automatic = GUILayout.Toggle(automatic, "Auto");
GUILayout.FlexibleSpace();
automaticProp.boolValue = automatic;
EditorGUILayout.EndHorizontal();
if (automatic == false)
{
EditorGUILayout.PropertyField(verticalOrigin);
EditorGUILayout.PropertyField(verticalSize);
// if (verticalSize.doubleValue < 0.0)
// verticalSize.doubleValue = 0.0001;
}
else
{
EditorGUILayout.PropertyField(automaticVerticalViewGap, new GUIContent("Vertical Gap"));
}
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
serializedObject.Update();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e95afd72773c44d4ab4ccd60a38ac39e
timeCreated: 1504187754
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,328 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(PyramidChart), true)]
class PyramidChartInspetor : Editor
{
bool mCategories = false;
string mCategoryError = null;
string mNewCategoryName = "";
GUIStyle mRedStyle;
GUIStyle mBold;
HashSet<string> mAllNames = new HashSet<string>();
GUIStyle mSplitter;
List<int> mToRemove = new List<int>();
List<int> mToUp = new List<int>();
Dictionary<string, string> mOperations = new Dictionary<string, string>();
ChartDataEditor mWindow;
bool mUpdateWindow = false;
Texture mSettings;
RenameWindow mRenameWindow = null;
public void OnEnable()
{
mRedStyle = new GUIStyle();
mRedStyle.normal.textColor = Color.red;
mSplitter = new GUIStyle();
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
mSplitter.stretchWidth = true;
mSplitter.margin = new RectOffset(0, 0, 7, 7);
}
public void Splitter()
{
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
if (Event.current.type == EventType.Repaint)
{
Color restoreColor = GUI.color;
GUI.color = new Color(0.5f, 0.5f, 0.5f);
mSplitter.Draw(position, false, false, false, false);
GUI.color = restoreColor;
}
}
private static bool IsAlphaNum(string str)
{
if (string.IsNullOrEmpty(str))
return false;
for (int i = 0; i < str.Length; i++)
{
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
return false;
}
return true;
}
private void DoOperations(SerializedProperty items, int size, string type)
{
mToRemove.Clear();
mToUp.Clear();
bool up = false;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
string arg = type + "|" + name;
string res = null;
if (up == true)
{
mToUp.Add(i);
up = false;
}
if (mOperations.TryGetValue(arg, out res))
{
if (res == "remove")
mToRemove.Add(i);
if (res == "up" && i > 0)
mToUp.Add(i);
if (res == "down")
up = true;
mOperations.Remove(arg);
}
}
for (int i = 0; i < mToRemove.Count; i++)
items.DeleteArrayElementAtIndex(mToRemove[i]);
for (int i = 0; i < mToUp.Count; i++)
{
int cur = mToUp[i];
items.MoveArrayElement(cur, cur - 1);
}
}
private SerializedProperty getArrayCategory(SerializedProperty arr, string name)
{
for (int i = 0; i < arr.arraySize; i++)
{
SerializedProperty prop = arr.GetArrayElementAtIndex(i);
if (prop.FindPropertyRelative("ColumnName").stringValue == name)
return prop.FindPropertyRelative("Amount");
}
return null;
}
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
{
SerializedProperty items = data.FindPropertyRelative(property);
SerializedProperty dataValues = data.FindPropertyRelative("mData");
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
//bool up, down;
mAllNames.Clear();
int size = items.arraySize;
if (Event.current.type == EventType.Layout)
DoOperations(items, size, type);
size = items.arraySize;
if (items.isExpanded)
{
EditorGUI.indentLevel++;
for (int i = 0; i < size; i++)
{
SerializedProperty entry = items.GetArrayElementAtIndex(i);
if (entry == null)
continue;
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
string name = null;
if (nameProp == null)
name = entry.stringValue;
else
name = nameProp.stringValue;
mAllNames.Add(name);
bool toogle = false;
EditorGUILayout.BeginHorizontal();
if (nameProp != null)
toogle = entry.isExpanded =EditorGUILayout.Foldout(entry.isExpanded, name);
else
{
toogle = false;
EditorGUILayout.LabelField(name);
}
SerializedProperty valueProp = getArrayCategory(dataValues, name);
GUILayout.FlexibleSpace();
// if(valueProp != null)
// EditorGUILayout.PropertyField(valueProp);
if (GUILayout.Button("..."))
DoContext(type, name);
EditorGUILayout.EndHorizontal();
if (toogle)
{
EditorGUI.indentLevel++;
if (nameProp != null)
{
SerializedProperty end = entry.GetEndProperty(true);
entry.Next(true);
if (SerializedProperty.EqualContents(entry, end) == false)
{
do
{
if (entry.name != "Name")
EditorGUILayout.PropertyField(entry, true);
if (entry.name == "HeightRatio" && valueProp != null)
valueProp.floatValue = entry.floatValue;
}
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
}
}
EditorGUI.indentLevel--;
}
}
if (errorMessage != null)
EditorGUILayout.LabelField(errorMessage, mRedStyle);
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
EditorGUILayout.BeginHorizontal();
newName = EditorGUILayout.TextField(newName);
//GUILayout.Space(indentAdd.xMin);
if (GUILayout.Button("Add"))
{
bool error = false;
if (newName.Trim().Length == 0)
{
errorMessage = "Name can't be empty";
error = true;
}
else if (IsAlphaNum(newName) == false)
{
errorMessage = "Name conatins invalid characters";
error = true;
}
else if (mAllNames.Contains(newName))
{
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
error = true;
}
if (error == false)
{
errorMessage = null;
items.InsertArrayElementAtIndex(size);
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
if (newItemName == null)
newItem.stringValue = newName;
else
newItemName.stringValue = newName;
newName = "";
UpdateWindow();
}
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
else
{
errorMessage = null;
}
UpdateWindow();
}
void callback(object val)
{
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
mOperations[pair.Key] = pair.Value;
}
bool RenameCategory(string fromName, string toName)
{
PyramidChart pyramidChart = (PyramidChart)serializedObject.targetObject;
try
{
pyramidChart.DataSource.RenameCategory(fromName, toName);
}
catch (Exception)
{
return false;
}
serializedObject.Update();
if (pyramidChart.gameObject.activeInHierarchy)
pyramidChart.GenerateChart();
else
EditorUtility.SetDirty(pyramidChart);
return true;
}
void RenameCalled(object val)
{
var data = (KeyValuePair<string, string>)val;
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
mRenameWindow = window;
if (data.Key == "category")
window.ShowDialog(data.Value, data.Key, RenameCategory);
}
void DoContext(string type, string name)
{
string arg = type + "|" + name;
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
menu.ShowAsContext();
}
void UpdateWindow()
{
mUpdateWindow = true;
}
void OnDisable()
{
if(mRenameWindow != null)
{
mRenameWindow.Close();
mRenameWindow = null;
}
if (mWindow != null)
{
mWindow.Close();
mWindow = null;
}
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
SerializedProperty barData = serializedObject.FindProperty("Data");
EditorGUILayout.BeginVertical();
Splitter();
if (mBold == null)
mBold = new GUIStyle(EditorStyles.foldout);
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
NamedItemEditor(barData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
serializedObject.Update();
if (mUpdateWindow == true)
{
mUpdateWindow = false;
if (mWindow != null)
{
mWindow.SetEditedObject(serializedObject);
mWindow.Repaint();
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 79e4c0b8020ab4a42a6d990ae8dc88c3
timeCreated: 1579446121
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 30e0bcb506988d7498bdbaa0867abcf1
folderAsset: yes
timeCreated: 1578946274
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
interface IInternalPyramidData
{
ChartSparseDataSource InternalDataSource { get; }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 369d1c0e7b4b9fc498252bc1ed05b04c
timeCreated: 1579445919
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
public interface IPyramidGenerator
{
GameObject ContainerObject { get; }
void SetParams(float baseX1, float baseX2, float baseSize, float slopLeft, float slopeRight, float height,float inset,float startV,float endV);
Vector3 GetTextPosition(PyramidChart.JustificationType justification,bool isBase);
void GetUpperBase(out float baseX1, out float baseX2);
void Generate();
void ApplyInfo(string title, string text, Sprite image, float scale);
void SetAlpha(float alpha);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2a1189b51e201054181a7018cd594f6c
timeCreated: 1579168376
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
#define Graph_And_Chart_PRO
using UnityEngine;
using System.Collections;
using ChartAndGraph;
public class PyramidAnimation : MonoBehaviour {
public AnimationCurve Curve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
public bool AnimateOnStart = true;
public float AnimationTime = 3f;
float animationStart = -1f;
PyramidChart chart;
// Use this for initialization
void Start () {
chart = GetComponent<PyramidChart>();
if (AnimateOnStart)
Animate();
}
public void Animate()
{
animationStart = Time.time;
}
// Update is called once per frame
void Update ()
{
if (chart == null)
return;
if (animationStart < 0f)
return;
float elasped = (Time.time - animationStart) / AnimationTime;
elasped = Mathf.Clamp(elasped, 0f, 1f);
float blend = Curve.Evaluate(elasped);
for(int i=0; i<chart.DataSource.TotalCategories; i++)
{
string name = chart.DataSource.GetCategoryName(i);
chart.DataSource.SetCategoryAlpha(name, blend);
chart.DataSource.SetCategoryOrientation(name, blend, 0f, 0f);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3f8e5b63d2caba14993994657aeb9d90
timeCreated: 1579516412
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,202 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace ChartAndGraph
{
[Serializable]
public class PyramidCanvasGenerator : MaskableGraphic, IPyramidGenerator
{
public RectTransform Container;
public Text Title;
public Text Info;
public Image Sprite;
bool mPopulated = false;
float mBaseX1;
float mBaseX2;
float mBaseSize;
float mSlopLeft;
float mSlopeRight;
float mHeight;
float mInset;
float mStartV;
float mEndV;
CanvasGroup mGroup;
UIVertex[] vertices = new UIVertex[4];
Vector2[] normals = new Vector2[4];
protected override void Start()
{
base.Start();
mGroup = ChartCommon.EnsureComponent<CanvasGroup>(gameObject);
}
public GameObject ContainerObject {
get {
if (Container == null)
return null;
return Container.gameObject;
}
}
public void SetAlpha(float alpha)
{
if(mGroup != null)
mGroup.alpha = alpha;
}
public override Texture mainTexture
{
get { return material.mainTexture; }
}
public void ApplyInfo(string title, string text, Sprite image,float scale)
{
if(Container != null)
{
Vector3 centtroid = vertices[0].position + vertices[1].position + vertices[2].position + vertices[3].position;
centtroid *= 0.25f;
float upperSize = Math.Abs(vertices[2].position.x - vertices[3].position.x);
float downSize = Math.Abs(vertices[0].position.x - vertices[1].position.x);
float total = upperSize + downSize;
float weight = (downSize - upperSize) / total;
weight = -weight * 0.5f + 0.5f;
weight = Mathf.Lerp(0.3f, 0.7f, weight);
centtroid.y = Mathf.Lerp(vertices[0].position.y, vertices[2].position.y, weight);
centtroid = new Vector3(centtroid.x / rectTransform.rect.width, centtroid.y / rectTransform.rect.height);
centtroid += new Vector3(0.5f, 0.5f, 0f);
Container.anchorMax = centtroid;
Container.anchorMin = centtroid;
Container.anchoredPosition = new Vector2();
Container.sizeDelta = new Vector2(Mathf.Abs(mBaseX1 - mBaseX2) - mInset*4, mHeight - mInset*2);
Container.localScale = new Vector3(scale, scale, scale);
}
if (Title != null)
Title.text = title;
if (Info != null)
Info.text = text;
if (Sprite != null)
Sprite.sprite = image;
}
public void Generate()
{
SetAllDirty();
Rebuild(CanvasUpdate.PreRender);
}
public Vector3 GetTextPosition(PyramidChart.JustificationType justification, bool isBase)
{
Vector3 res = new Vector3();
switch(justification)
{
case PyramidChart.JustificationType.LeftAligned:
if (isBase)
res = vertices[0].position;
else
res = (vertices[0].position + vertices[2].position) * 0.5f;
break;
case PyramidChart.JustificationType.RightAligned:
if (isBase)
res = vertices[1].position;
else
res = (vertices[1].position + vertices[3].position) * 0.5f;
break;
case PyramidChart.JustificationType.CenterAligned:
if (isBase)
res = (vertices[0].position + vertices[1].position) * 0.5f;
else
res = (vertices[0].position + vertices[1].position +vertices[2].position + vertices[3].position) * 0.25f;
break;
}
return res;
}
public void GetUpperBase(out float baseX1, out float baseX2)
{
baseX1 = vertices[2].position.x + mBaseSize * 0.5f;
baseX2 = vertices[3].position.x + mBaseSize * 0.5f;
}
public void SetParams(float baseX1, float baseX2, float baseSize, float slopLeft, float slopeRight, float height, float inset, float startV, float endV)
{
mPopulated = true;
mBaseX1 = baseX1;
mBaseX2 = baseX2;
mBaseSize = baseSize;
mSlopLeft = slopLeft;
mSlopeRight = slopeRight;
mHeight = height;
mInset = inset;
mStartV = startV;
mEndV = endV;
PyramidMesh.Generate2dMesh(vertices, normals, mBaseX1, mBaseX2, mBaseSize, mSlopLeft, mSlopeRight, mHeight,mStartV,mEndV);
}
#pragma warning disable 0672
protected override void OnFillVBO(List<UIVertex> vbo)
{
vbo.Clear();
if (mPopulated == false)
return;
CanvasChartMesh mesh = new CanvasChartMesh(vbo);
FillChartMesh(mesh);
}
#pragma warning restore 0672
#if (!UNITY_5_2_0) && (!UNITY_5_2_1)
protected override void OnPopulateMesh(VertexHelper vh)
{
vh.Clear();
if (mPopulated == false)
return;
CanvasChartMesh mesh = new CanvasChartMesh(vh);
FillChartMesh(mesh);
}
#endif
#pragma warning disable 0672
#if !UNITY_2017_1_OR_NEWER
protected override void OnPopulateMesh(Mesh m)
{
m.Clear();
if (mPopulated == false)
return;
WorldSpaceChartMesh chartmesh = new WorldSpaceChartMesh(true);
FillChartMesh(chartmesh);
chartmesh.ApplyToMesh(m);
}
#endif
#pragma warning restore 0672
void FillChartMesh(IChartMesh mesh)
{
UIVertex v1 = vertices[0];
UIVertex v2 = vertices[1];
UIVertex v3 = vertices[2];
UIVertex v4 = vertices[3];
v1.position += (Vector3)(normals[0] * mInset);
v2.position += (Vector3)(normals[1] * mInset);
v3.position += (Vector3)(normals[2] * mInset);
v4.position += (Vector3)(normals[3] * mInset);
Vector2 inter;
if(ChartCommon.SegmentIntersection(v1.position,v3.position,v2.position,v4.position,out inter))
{
v3.position = inter;
v4.position = inter;
}
mesh.AddQuad(v1, v2, v3, v4);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7b2cb334c0c0a6448971702fcddbfecd
timeCreated: 1579182822
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,639 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace ChartAndGraph
{
/// <summary>
/// Pie chart class
/// </summary>
[ExecuteInEditMode]
[Serializable]
public class PyramidChart : AnyChart
{
public class PyramidEventArgs
{
public PyramidEventArgs(string category, string title,string text)
{
Title = title;
Text = text;
Category = category;
}
public string Category { get; private set; }
public string Title { get; private set; }
public string Text { get; private set; }
}
public enum JustificationType
{
LeftAligned,
RightAligned,
CenterAligned
}
public enum SlopeType
{
Center,
Left,
Right,
Custom
}
bool mQuick = false;
[Serializable]
public class PyramidEvent : UnityEvent<PyramidEventArgs>
{
}
/// <summary>
/// occures when a pie item is clicked
/// </summary>
public PyramidEvent ItemClicked = new PyramidEvent();
/// <summary>
/// occures when a pie item is hovered
/// </summary>
public PyramidEvent ItemHovered = new PyramidEvent();
/// <summary>
/// occurs when no pie is hovered any longer
/// </summary>
public UnityEvent NonHovered = new UnityEvent();
[SerializeField]
[Tooltip("The material of the back of the pyramid")]
public Material backMaterial;
/// <summary>
/// The inset of each pyramid component
/// </summary>
public Material BackMaterial
{
get { return backMaterial; }
set
{
backMaterial = value;
OnPropertyUpdated();
}
}
[SerializeField]
[Tooltip("The inset of each pyramid component")]
public float inset;
/// <summary>
/// The inset of each pyramid component
/// </summary>
public float Inset
{
get { return inset; }
set
{
inset = value;
OnPropertyUpdated();
}
}
[SerializeField]
[Tooltip("the text justification of the pyramid chart")]
private JustificationType justification;
/// <summary>
/// the text justification of the pyramid chart
/// </summary>
public JustificationType Justification
{
get { return justification; }
set
{
justification = value;
OnPropertyUpdated();
}
}
[SerializeField]
[Tooltip("the slope type of the pyramid")]
public SlopeType slope;
/// <summary>
/// prefab for the pie item. must contain a PieCanvasGenerator component
/// </summary>
public SlopeType Slope
{
get { return slope; }
set
{
slope = value;
OnPropertyUpdated();
}
}
[SerializeField]
[Tooltip("prefab for the pyramid item. must contain a PyramidCanvasGenerator component")]
private PyramidCanvasGenerator prefab;
/// <summary>
/// prefab for the pie item. must contain a PieCanvasGenerator component
/// </summary>
public PyramidCanvasGenerator Prefab
{
get { return prefab; }
set
{
prefab = value;
OnPropertyUpdated();
}
}
[HideInInspector]
[SerializeField]
private PyramidData Data = new PyramidData();
float totalWidth, totalHeight;
protected override IChartData DataLink
{
get
{
return Data;
}
}
public PyramidData DataSource
{
get { return Data; }
}
public override bool SupportRealtimeGeneration
{
get
{
return false;
}
}
protected override LegenedData LegendInfo
{
get
{
LegenedData legend = new LegenedData();
if (Data == null)
return legend;
foreach (var column in ((IInternalPyramidData)Data).InternalDataSource.Columns)
{
var item = new LegenedData.LegenedItem();
item.Name = column.Name;
if (column.Material != null)
item.Material = column.Material.Normal;
else
item.Material = null;
legend.AddLegenedItem(item);
}
return legend;
}
}
public PyramidChart()
{
}
public class PyramidObject
{
public string category;
public GameObject pyramidObject;
public GameObject backObject;
public IPyramidGenerator Generator;
public IPyramidGenerator BackGenerator;
public string Title, Text;
public BillboardText ItemLabel;
}
Dictionary<string, PyramidObject> mPyramids = new Dictionary<string, PyramidObject>();
void HookEvents()
{
Data.ProperyUpdated -= Data_ProperyUpdated;
Data.ProperyUpdated += Data_ProperyUpdated;
Data.RealtimeProperyUpdated -= Data_RealtimeProperyUpdated;
Data.RealtimeProperyUpdated += Data_RealtimeProperyUpdated;
((IInternalPyramidData)Data).InternalDataSource.DataStructureChanged -= MDataSource_DataStructureChanged;
((IInternalPyramidData)Data).InternalDataSource.DataStructureChanged += MDataSource_DataStructureChanged;
((IInternalPyramidData)Data).InternalDataSource.DataValueChanged -= MDataSource_DataValueChanged;
((IInternalPyramidData)Data).InternalDataSource.DataValueChanged += MDataSource_DataValueChanged;
}
private void Data_RealtimeProperyUpdated()
{
QuickInvalidate();
}
private void Data_ProperyUpdated()
{
Invalidate();
}
protected void QuickInvalidate()
{
if (Invalidating)
return;
Invalidate();
mQuick = true;
}
public override void Invalidate()
{
base.Invalidate();
mQuick = false;
}
private void MDataSource_DataValueChanged(object sender, DataSource.ChartDataSourceBase.DataValueChangedEventArgs e)
{
QuickInvalidate();
}
private void MDataSource_DataStructureChanged(object sender, EventArgs e)
{
Invalidate();
}
protected override void Start()
{
base.Start();
if (ChartCommon.IsInEditMode == false)
{
HookEvents();
}
Invalidate();
}
protected override void OnValidate()
{
base.OnValidate();
if (Application.isPlaying)
{
HookEvents();
}
Invalidate();
}
protected override void ClearChart()
{
base.ClearChart();
mPyramids.Clear();
}
Vector3 AlignTextPosition(AlignedItemLabels labels, PyramidObject obj, IPyramidGenerator generator,float height)
{
Vector3 position = new Vector3(labels.Location.Breadth, labels.Seperation, labels.Location.Depth);
position.y += height;
position = generator.GetTextPosition(justification, labels.Alignment == ChartLabelAlignment.Base);
return position;
}
protected IPyramidGenerator PreparePyramidObject(out GameObject pyramidObject)
{
if (Prefab == null)
pyramidObject = new GameObject();
else
pyramidObject = GameObject.Instantiate(Prefab.gameObject);
ChartCommon.EnsureComponent<RectTransform>(pyramidObject);
ChartCommon.EnsureComponent<CanvasRenderer>(pyramidObject);
return ChartCommon.EnsureComponent<PyramidCanvasGenerator>(pyramidObject);
}
private void GeneratePyramid(bool update)
{
if (update == false)
ClearChart();
else
EnsureTextController();
if (((IInternalPyramidData)Data).InternalDataSource == null)
return;
double[,] data = ((IInternalPyramidData)Data).InternalDataSource.getRawData();
int rowCount = data.GetLength(0);
int columnCount = data.GetLength(1);
if (rowCount != 1) // row count for pie must be 1
return;
double total = 0.0;
for (int i = 0; i < columnCount; ++i)
{
double val = Math.Max(data[0, i], 0);
total += val;
}
var rectTrans = GetComponent<RectTransform>();
totalHeight = rectTrans.rect.height;
totalWidth = rectTrans.rect.width;
float baseX1 = 0;
float baseX2 = totalWidth;
float accumilatedHeight = 0;
float? firstCenterHeight = null;
float acummilatedWeight = 0;
for (int i = 0; i < columnCount; ++i)
{
object userData = ((IInternalPyramidData)Data).InternalDataSource.Columns[i].UserData;
var categoryData = ((PyramidData.CategoryData)userData);
string name = ((IInternalPyramidData)Data).InternalDataSource.Columns[i].Name;
double amount = Math.Max(data[0, i], 0);
if (amount == 0f)
continue;
float weight = (float)(amount / total);
float actualHeight = totalHeight * weight;
float slopeRight = categoryData.RightSlope;
float slopeLeft = categoryData.LeftSlope;
float atan;
switch(slope)
{
case SlopeType.Center:
atan = -Mathf.Atan2(totalHeight, totalWidth * 0.5f) * Mathf.Rad2Deg +90;
slopeRight = atan;
slopeLeft = atan;
break;
case SlopeType.Left:
atan = -Mathf.Atan2(totalHeight, totalWidth) * Mathf.Rad2Deg + 90;
slopeLeft = 0;
slopeRight = atan;
break;
case SlopeType.Right:
atan = -Mathf.Atan2(totalHeight, totalWidth) * Mathf.Rad2Deg + 90;
slopeLeft = atan;
slopeRight = 0;
break;
default:
break;
}
GameObject pyramidObject = null;
GameObject pyramidBackObject = null;
IPyramidGenerator generator = null;
IPyramidGenerator backgenerator = null;
PyramidObject dataObject;
float centerHeight = actualHeight * 0.5f + accumilatedHeight;
float unblendedHeight = centerHeight;
if (firstCenterHeight.HasValue == false)
firstCenterHeight = centerHeight;
centerHeight = Mathf.Lerp(firstCenterHeight.Value, centerHeight, categoryData.PositionBlend);
if (mPyramids.TryGetValue(name, out dataObject))
{
pyramidBackObject = dataObject.backObject;
pyramidObject = dataObject.pyramidObject;
backgenerator = dataObject.BackGenerator;
generator = dataObject.Generator;
generator.SetParams(baseX1, baseX2, totalWidth, slopeLeft, slopeRight, actualHeight,inset,0f,1f);
if (backgenerator !=null)
backgenerator.SetParams(baseX1, baseX2, totalWidth, slopeLeft, slopeRight, actualHeight, 0f, acummilatedWeight, acummilatedWeight + weight);
if (dataObject.ItemLabel)
{
Vector3 labelPos = AlignTextPosition(mItemLabels, dataObject,generator, centerHeight);
dataObject.ItemLabel.transform.localPosition = labelPos;
ChartCommon.UpdateTextParams(dataObject.ItemLabel.UIText, categoryData.Title);
}
}
else
{
dataObject = new PyramidObject();
if (backMaterial != null)
{
var backGenerator = PreparePyramidObject(out pyramidBackObject);
backGenerator.SetParams(baseX1, baseX2, totalWidth, slopeLeft, slopeRight, actualHeight, 0f, acummilatedWeight, acummilatedWeight +weight);
dataObject.backObject = pyramidBackObject;
dataObject.BackGenerator = backGenerator;
ChartCommon.HideObject(pyramidBackObject, hideHierarchy);
pyramidBackObject.transform.SetParent(transform,false);
ChartCommon.EnsureComponent<ChartItem>(pyramidBackObject);
ChartMaterialController backcontrol = ChartCommon.EnsureComponent<ChartMaterialController>(pyramidBackObject);
backcontrol.Materials = new ChartDynamicMaterial(backMaterial);
foreach(var itemEffect in pyramidBackObject.GetComponents<ChartItemEffect>())
ChartCommon.SafeDestroy(itemEffect);
ChartCommon.SafeDestroy(backGenerator.ContainerObject);
}
generator = PreparePyramidObject(out pyramidObject);
generator.SetParams(baseX1, baseX2, totalWidth, slopeLeft, slopeRight, actualHeight, inset,0f,1f);
ChartCommon.HideObject(pyramidObject, hideHierarchy);
pyramidObject.transform.SetParent(transform,false);
ChartCommon.EnsureComponent<ChartItem>(pyramidObject);
ChartMaterialController control = ChartCommon.EnsureComponent<ChartMaterialController>(pyramidObject);
control.Materials = Data.GetMaterial(name);
control.Refresh();
dataObject.Generator = generator;
dataObject.category = name;
dataObject.pyramidObject = pyramidObject;
mPyramids.Add(name, dataObject);
CharItemEffectController effect = ChartCommon.EnsureComponent<CharItemEffectController>(pyramidObject);
effect.WorkOnParent = false;
effect.InitialScale = false;
ChartItemEvents[] events = pyramidObject.GetComponentsInChildren<ChartItemEvents>();
for (int j = 0; j < events.Length; ++j)
{
if (events[j] == null)
continue;
InternalItemEvents comp = (InternalItemEvents)events[j];
comp.Parent = this;
comp.UserData = dataObject;
}
if (mItemLabels != null)
{
Vector3 labelPos = AlignTextPosition(mItemLabels, dataObject, generator, 0f);
float angle = justification == JustificationType.LeftAligned ? -180f : 180f;
BillboardText billboard = ChartCommon.CreateBillboardText(null, mItemLabels.TextPrefab, dataObject.pyramidObject.transform, categoryData.Title, labelPos.x, labelPos.y, labelPos.z, angle, null, hideHierarchy, mItemLabels.FontSize, mItemLabels.FontSharpness);
dataObject.ItemLabel = billboard;
dataObject.ItemLabel.transform.localPosition = labelPos;
TextController.AddText(billboard);
}
}
dataObject.Text = categoryData.Text;
dataObject.Title = categoryData.Title;
if (IsCanvas)
{
if (pyramidObject != null)
{
Vector2 actualPosition = new Vector2(0.5f, centerHeight) + categoryData.Shift;
actualPosition = new Vector2(actualPosition.x , actualPosition.y / TotalHeight);
var objectRect = pyramidObject.GetComponent<RectTransform>();
objectRect.pivot = new Vector2(0.5f, 0.5f);
objectRect.anchorMin = actualPosition;
objectRect.anchorMax = actualPosition;
objectRect.anchoredPosition = new Vector2();
objectRect.sizeDelta = new Vector2(totalWidth, actualHeight);
}
if(pyramidBackObject != null)
{
Vector2 actualPosition = new Vector2(0.5f, unblendedHeight);
actualPosition = new Vector2(actualPosition.x, actualPosition.y / TotalHeight);
var objectRect = pyramidBackObject.GetComponent<RectTransform>();
objectRect.pivot = new Vector2(0f, 0f);
objectRect.anchorMin = actualPosition;
objectRect.anchorMax = actualPosition;
objectRect.anchoredPosition = new Vector2();
}
}
accumilatedHeight += actualHeight;
acummilatedWeight += weight;
if(backgenerator!= null)
backgenerator.Generate();
generator.Generate();
generator.GetUpperBase(out baseX1, out baseX2);
generator.ApplyInfo(categoryData.Title, categoryData.Text, categoryData.Image,categoryData.Scale);
generator.SetAlpha(categoryData.Alpha);
}
}
protected override void OnLabelSettingChanged()
{
base.OnLabelSettingChanged();
Invalidate();
}
protected override void OnLabelSettingsSet()
{
base.OnLabelSettingsSet();
Invalidate();
}
public override void InternalGenerateChart()
{
if (gameObject.activeInHierarchy == false)
return;
base.InternalGenerateChart();
GeneratePyramid(mQuick);
mQuick = false;
}
protected override bool HasValues(AxisBase axis)
{
return false;
}
protected override double MaxValue(AxisBase axis)
{
return 0.0;
}
protected override double MinValue(AxisBase axis)
{
return 0.0;
}
protected virtual void OnPropertyChanged()
{
QuickInvalidate();
}
protected override void OnPropertyUpdated()
{
base.OnPropertyUpdated();
Invalidate();
}
protected override void ValidateProperties()
{
base.ValidateProperties();
if (inset < 0)
inset = 0;
}
PyramidEventArgs userDataToEventArgs(object userData)
{
PyramidObject pyramid = (PyramidObject)userData;
return new PyramidEventArgs(pyramid.category, pyramid.Title,pyramid.Text);
}
protected override void OnNonHoverted()
{
base.OnNonHoverted();
if (NonHovered != null)
NonHovered.Invoke();
}
protected override void OnItemHoverted(object userData)
{
base.OnItemHoverted(userData);
if (ItemHovered != null)
ItemHovered.Invoke(userDataToEventArgs(userData));
}
protected override void OnItemSelected(object userData)
{
base.OnItemSelected(userData);
var args = userDataToEventArgs(userData);
if (ItemClicked != null)
ItemClicked.Invoke(args);
}
protected override void Update()
{
base.Update();
}
protected override bool SupportsCategoryLabels
{
get
{
return true;
}
}
protected override bool SupportsGroupLables
{
get
{
return false;
}
}
protected override bool SupportsItemLabels
{
get
{
return false;
}
}
protected override bool ShouldFitCanvas { get { return false; } }
protected override float TotalDepthLink { get { return 0f; } }
protected override float TotalHeightLink { get { return totalHeight; } }
protected override float TotalWidthLink { get { return totalWidth; } }
public override bool IsCanvas { get { return true; } }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5d0cd7c0544e4cc439d4a030e8a7a470
timeCreated: 1578949498
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,450 @@
#define Graph_And_Chart_PRO
using ChartAndGraph.DataSource;
using ChartAndGraph.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
[Serializable]
public class PyramidData : AbstractChartData, IInternalPyramidData, IChartData
{
[Serializable]
internal class CategoryData
{
public string Name;
public ChartDynamicMaterial Materials;
public String Title;
public String Text;
public Sprite Image;
public float RightSlope;
public float LeftSlope;
public float HeightRatio;
public float Alpha;
public float Scale;
public float ShiftX, ShiftY;
public float PositionBlend;
public Vector2 Shift { get { return new Vector2(ShiftX, ShiftY); } }
}
[Serializable]
class DataEntry
{
public string GroupName;
public string ColumnName;
public double Amount;
}
public PyramidData()
{
mDataSource = new ChartSparseDataSource();
if (mDataSource.Rows.Count == 0)
mDataSource.Rows.Add(new DataSource.ChartDataRow("Pyramid"));
}
private ChartSparseDataSource mDataSource;
ChartSparseDataSource IInternalPyramidData.InternalDataSource { get { return mDataSource; } }
[SerializeField]
private CategoryData[] mCategories = new CategoryData[0];
[SerializeField]
private string[] mGroups = new string[1] { "Pyramid" };
[SerializeField]
private DataEntry[] mData = new DataEntry[0];
public int TotalCategories { get { return mDataSource.Columns.Count; } }
public void Update()
{
UpdateSliders();
}
public string GetCategoryName(int index)
{
return mDataSource.Columns[index].Name;
}
public void OnBeforeSerialize()
{
int totalColumns = mDataSource.Columns.Count;
mCategories = new CategoryData[totalColumns];
for (int i = 0; i < totalColumns; i++)
{
CategoryData data = new CategoryData();
data.Name = mDataSource.Columns[i].Name;
data.Materials = mDataSource.Columns[i].Material;
object userData = mDataSource.Columns[i].UserData;
if (userData != null && userData is CategoryData)
{
data.Alpha = ((CategoryData)userData).Alpha;
data.HeightRatio = ((CategoryData)userData).HeightRatio;
data.Image = ((CategoryData)userData).Image;
data.Title = ((CategoryData)userData).Title;
data.LeftSlope = ((CategoryData)userData).LeftSlope;
data.RightSlope = ((CategoryData)userData).RightSlope;
data.Scale = ((CategoryData)userData).Scale;
data.ShiftX = ((CategoryData)userData).ShiftX;
data.ShiftY = ((CategoryData)userData).ShiftY;
data.Text = ((CategoryData)userData).Text;
data.PositionBlend = ((CategoryData)userData).PositionBlend;
}
else
{
data.Alpha = 1f;
data.HeightRatio = 1f;
data.Image = null;
data.Title = "";
data.LeftSlope = -0.5f;
data.RightSlope = -0.5f;
data.Scale = 1f;
data.ShiftX = 0f;
data.ShiftY = 0f;
data.Text = ((CategoryData)userData).Text;
data.PositionBlend = 1f;
}
mCategories[i] = data;
}
int totalRows = mDataSource.Rows.Count;
mGroups = new string[totalRows];
for (int i = 0; i < totalRows; i++)
mGroups[i] = mDataSource.Rows[i].Name;
double[,] raw = mDataSource.getRawData();
int current = 0;
mData = new DataEntry[raw.GetLength(0) * raw.GetLength(1)];
for (int i = 0; i < raw.GetLength(0); ++i)
{
for (int j = 0; j < raw.GetLength(1); ++j)
{
DataEntry entry = new DataEntry();
entry.ColumnName = mDataSource.Columns[j].Name;
entry.GroupName = mDataSource.Rows[i].Name;
entry.Amount = raw[i, j];
mData[current++] = entry;
}
}
}
public event Action ProperyUpdated;
public event Action RealtimeProperyUpdated;
protected void RaiseRealtimePropertyUpdated()
{
if (RealtimeProperyUpdated != null)
RealtimeProperyUpdated();
}
protected void RaisePropertyUpdated()
{
if (ProperyUpdated != null)
ProperyUpdated();
}
public bool HasCategory(string category)
{
try
{
var col = mDataSource.Columns[category];
if (col != null)
return true;
}
catch
{
}
return false;
}
/// <summary>
/// rename a category. throws an exception on error
/// </summary>
/// <param name="prevName"></param>
/// <param name="newName"></param>
public void RenameCategory(string prevName, string newName)
{
mDataSource.Columns[prevName].Name = newName;
RaisePropertyUpdated();
}
public object StoreCategory(string category)
{
CategoryData data = (CategoryData)(mDataSource.Columns[category].UserData);
data.Materials = mDataSource.Columns[category].Material;
return data;
}
public void RestoreCategory(string category, object data)
{
var toSet = (CategoryData)data;
CategoryData current = (CategoryData)(mDataSource.Columns[category].UserData);
current.Alpha = ((CategoryData)toSet).Alpha;
current.HeightRatio = ((CategoryData)toSet).HeightRatio;
current.Image = ((CategoryData)toSet).Image;
current.Title = ((CategoryData)toSet).Title;
current.LeftSlope = ((CategoryData)toSet).LeftSlope;
current.RightSlope = ((CategoryData)toSet).RightSlope;
current.Scale = ((CategoryData)toSet).Scale;
current.ShiftX = ((CategoryData)toSet).ShiftX;
current.ShiftY = ((CategoryData)toSet).ShiftY;
current.Text = ((CategoryData)toSet).Text;
current.PositionBlend = ((CategoryData)toSet).PositionBlend;
current.Materials = toSet.Materials;
mDataSource.Columns[category].Material = toSet.Materials;
RaisePropertyUpdated();
}
/// <summary>
/// call this to suspend chart redrawing while updating the data of the chart
/// </summary>
public void StartBatch()
{
mDataSource.SuspendEvents = true;
}
/// <summary>
/// call this after StartBatch , this will apply all the changed made between the StartBatch call to this call
/// </summary>
public void EndBatch()
{
mDataSource.SuspendEvents = false;
}
public void OnAfterDeserialize()
{
mDataSource = new ChartSparseDataSource();
mDataSource.SuspendEvents = true;
mDataSource.Clear();
if (mCategories == null)
mCategories = new CategoryData[0];
if (mGroups == null)
mGroups = new string[0];
if (mData == null)
mData = new DataEntry[0];
for (int i = 0; i < mCategories.Length; i++)
AddCategory(mCategories[i].Name, mCategories[i].Materials, mCategories[i].Title, mCategories[i].Text, mCategories[i].Image, mCategories[i].Alpha, mCategories[i].HeightRatio, mCategories[i].LeftSlope, mCategories[i].RightSlope, mCategories[i].PositionBlend, mCategories[i].Scale, mCategories[i].ShiftX, mCategories[i].ShiftY);
// for (int i = 0; i < mGroups.Length; i++)
// AddGroup(mGroups[i]);
if (mDataSource.Rows.Count == 0)
mDataSource.Rows.Add(new DataSource.ChartDataRow("Pyramid"));
for (int i = 0; i < mData.Length; i++)
{
try
{
DataEntry entry = mData[i];
mDataSource.SetValue(entry.ColumnName, entry.GroupName, entry.Amount);
}
catch (Exception)
{
}
}
mDataSource.SuspendEvents = false;
}
private void AddGroup(string name)
{
mDataSource.Rows.Add(new ChartDataRow(name));
}
/// <summary>
/// Adds a new category to the pyramid chart. Each category has it's own material and name. each category corresponds to one pyr slice
/// </summary>
/// <param name="name">the name of the category</param>
/// <param name="material">the material of the category</param>
public void AddCategory(string name, Material material, String title, String text, Sprite image)
{
AddCategory(name, new ChartDynamicMaterial(material),title,text,image);
}
/// <summary>
/// Adds a new category to the pyramid chart. Each category has it's own material and name. each category corresponds to one pie slice
/// </summary>
/// <param name="name">the name of the category</param>
/// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
public void AddCategory(string name, ChartDynamicMaterial material, String title, String text, Sprite image,float alpha = 1f,float heightRatio = 1f,float leftSlope = 45f,float rightSlope = 45f,float positionBlend = 1f,float scale = 1f, float shiftX = 0f,float shiftY =0f)
{
if (title == null)
title = "";
if (text == null)
text = "";
ChartDataColumn column = new ChartDataColumn(name);
column.Material = material;
CategoryData d = new CategoryData();
d.Title = title;
d.Text = text;
d.Image = image;
d.Alpha = alpha;
d.HeightRatio = heightRatio;
d.LeftSlope = leftSlope;
d.RightSlope = rightSlope;
d.PositionBlend = positionBlend;
d.Scale = scale;
d.ShiftX = shiftX;
d.ShiftY = shiftY;
column.UserData = d;
mDataSource.mColumns.Add(column);
SetValueInternal(name, "Pyramid", heightRatio);
}
public void SetCategoryInfo(string category,string title,string text,Sprite image)
{
if (title == null)
title = "";
if (text == null)
text = "";
var col = mDataSource.Columns[category];
CategoryData data = col.UserData as CategoryData;
data.Text = text;
data.Title = title;
data.Image = image;
RaisePropertyUpdated();
}
public void SetCategoryAlpha(string category, float alpha)
{
var col = mDataSource.Columns[category];
CategoryData data = col.UserData as CategoryData;
data.Alpha = alpha;
RaiseRealtimePropertyUpdated();
}
public void SetCategoryContentScale(string category,float scale)
{
var col = mDataSource.Columns[category];
CategoryData data = col.UserData as CategoryData;
data.Scale = scale;
RaiseRealtimePropertyUpdated();
}
public void SetCategoryOrientation(string category,float positionBlend,float shiftX ,float shiftY)
{
var col = mDataSource.Columns[category];
CategoryData data = col.UserData as CategoryData;
data.PositionBlend = positionBlend;
data.ShiftX = shiftX;
data.ShiftY = shiftY;
RaiseRealtimePropertyUpdated();
}
public void SetCategorySlope(string category,float leftSlop,float rightSlope)
{
var col = mDataSource.Columns[category];
CategoryData data = col.UserData as CategoryData;
data.LeftSlope = leftSlop;
data.RightSlope = rightSlope;
RaiseRealtimePropertyUpdated();
}
public void SetCategoryHeightRatio(string category, float heightRatio)
{
var col = mDataSource.Columns[category];
CategoryData data = col.UserData as CategoryData;
data.HeightRatio = heightRatio;
SetValueInternal(category, "Pyramid", heightRatio);
RaiseRealtimePropertyUpdated();
}
/// <summary>
/// clears the pyramid chart data
/// </summary>
public void Clear()
{
string[] groups = mDataSource.Columns.Select(x => x.Name).ToArray();
foreach (string s in groups)
{
RemoveCategory(s);
}
}
/// <summary>
/// sets the material for the specified category
/// </summary>
/// <param name="category">the name of the category</param>
/// <param name="material">the material of the category</param>
public void SetMaterial(string category, Material material)
{
SetMaterial(category, new ChartDynamicMaterial(material));
}
internal ChartDynamicMaterial GetMaterial(string category)
{
return mDataSource.Columns[category].Material;
}
/// <summary>
/// sets the material for the specified category
/// </summary>
/// <param name="category">the name of the category</param>
/// <param name="material">the dynamic material of the category. dynamic materials allow setting the material for different events</param>
public void SetMaterial(string category, ChartDynamicMaterial material)
{
mDataSource.Columns[category].Material = material;
RaisePropertyUpdated();
}
/// <summary>
/// removes a category from the pyramid chart
/// </summary>
/// <param name="name">the name of the category to remove</param>
public void RemoveCategory(string name)
{
ChartDataColumn column = mDataSource.Columns[name];
RemoveSlider(name, "Pyramid");
mDataSource.Columns.Remove(column);
}
/// <summary>
/// gets the value for the specified category
/// </summary>
/// <param name="category">the category name</param>
/// <param name="group">the group name</param>
/// <returns></returns>
public double GetValue(string category)
{
return mDataSource.GetValue(category, "Pyramid");
}
public bool CheckAnimationEnded(float time, AnimationCurve curve)
{
if (curve.length == 0)
return true;
return time > curve.keys[curve.length - 1].time;
}
/// <summary>
/// used intenally , do not call
/// </summary>
/// <param name="cats"></param>
public object[] StoreAllCategoriesinOrder()
{
return mCategories.ToArray();
}
private void FixEaseFunction(AnimationCurve curve)
{
curve.postWrapMode = WrapMode.Once;
curve.preWrapMode = WrapMode.Once;
}
protected override void SetValueInternal(string column, string row, double value)
{
try
{
if(mDataSource.Rows.Count ==0 )
mDataSource.Rows.Add(new DataSource.ChartDataRow("Pyramid"));
mDataSource.SetValue(column, "Pyramid", value);
}
catch (ChartException e)
{
Debug.LogWarning(e.Message);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 46cd052151826fb41a072a83f913f790
timeCreated: 1578948915
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
class PyramidMesh
{
public static void Generate2dMesh(UIVertex[] mesh, Vector2[] normals,float baseX1, float baseX2,float baseSize, float slopLeft, float slopeRight, float height,float startV,float endV)
{
float halfHeight = height * 0.5f;
float halfWidth = baseSize * 0.5f;
slopLeft = -Mathf.Clamp(slopLeft, -90, 90) +90;
slopeRight = Mathf.Clamp(slopeRight ,- 90, 90) +90;
float tanLeft = (1f/Mathf.Tan(slopLeft * Mathf.Deg2Rad)) * height;
float tanRight =(1f/Mathf.Tan(slopeRight * Mathf.Deg2Rad)) * height;
float leftPos = baseX1 + tanLeft;
float rightPos = baseX2 + tanRight;
leftPos = Mathf.Clamp(leftPos, 0,baseSize);
rightPos = Mathf.Clamp(rightPos, 0, baseSize);
if (leftPos > rightPos)
leftPos = rightPos = Mathf.Clamp(Mathf.Lerp(leftPos, rightPos, 0.5f), 0, baseSize);
UIVertex v1 = ChartCommon.CreateVertex(new Vector3(baseX1 - halfWidth, -halfHeight), new Vector2(0f, startV));
UIVertex v2 = ChartCommon.CreateVertex(new Vector3(baseX2 - halfWidth, -halfHeight), new Vector2(1f, startV));
UIVertex v3 = ChartCommon.CreateVertex(new Vector3(leftPos - halfWidth, halfHeight), new Vector2(0f, endV));
UIVertex v4 = ChartCommon.CreateVertex(new Vector3(rightPos - halfWidth, halfHeight), new Vector2(1f, endV));
normals[0] = ((Vector2.up + ChartCommon.Perpendicular(v3.position - v1.position).normalized) * 0.5f).normalized;
normals[1] = ((Vector2.up + ChartCommon.Perpendicular(v2.position - v4.position).normalized) * 0.5f).normalized;
normals[2] = ((Vector2.down + ChartCommon.Perpendicular(v3.position - v1.position).normalized) * 0.5f).normalized;
normals[3] = ((Vector2.down + ChartCommon.Perpendicular(v2.position - v4.position).normalized) * 0.5f).normalized;
mesh[0] = v1;
mesh[1] = v2;
mesh[2] = v3;
mesh[3] = v4;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1cc5bd615b17ae34292624585cda8e6a
timeCreated: 1579182822
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b321e42897743dd4aa55fd6373025c34
folderAsset: yes
timeCreated: 1505898441
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1c5df8a40695a4340beca4c338df7e39
folderAsset: yes
timeCreated: 1491152606
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,651 @@
#define Graph_And_Chart_PRO
#define CandleChart
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
namespace ChartAndGraph
{
[ExecuteInEditMode]
public abstract class CandleChart : ScrollableAxisChart
{
/// <summary>
/// a candle chart event
/// </summary>
[Serializable]
public class CandleEvent : UnityEvent<CandleEventArgs>
{
}
[SerializeField]
[Tooltip("The height ratio of the chart")]
protected float heightRatio = 300;
[SerializeField]
[Tooltip("The width ratio of the chart")]
protected float widthRatio = 600;
protected override float TotalHeightLink
{
get
{
return heightRatio;
}
}
protected override float TotalWidthLink
{
get
{
return widthRatio;
}
}
/// <summary>
/// occures when a point is clicked
/// </summary>
public CandleEvent CandleClicked = new CandleEvent();
/// <summary>
/// occurs when a point is hovered
/// </summary>
public CandleEvent CandleHovered = new CandleEvent();
/// <summary>
/// occurs when no candle is hovered any longer
/// </summary>
public UnityEvent NonHovered = new UnityEvent();
public enum CandleThicknessMode
{
/// <summary>
/// the candle size is detemined only by the candle duration paramenter
/// </summary>
Fill,
/// <summary>
/// the candle is of constant size , regardless of the view size
/// </summary>
Constant,
/// <summary>
/// the candle size is fixed , but proportional to the view size
/// </summary>
Proportional
}
/// <summary>
/// format a candle value to the parameter strings
/// </summary>
/// <param name="candleVal"></param>
/// <param name="fractionDigits"></param>
/// <param name="open"></param>
/// <param name="high"></param>
/// <param name="low"></param>
/// <param name="close"></param>
public void FormatCandleValue(CandleChartData.CandleValue candleVal, int fractionDigits, out string open, out string high, out string low, out string close)
{
open = StringFromAxisFormat(new DoubleVector3(candleVal.Start,candleVal.Open,0.0), mVerticalAxis,false);
close = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Close, 0.0), mVerticalAxis, false);
high = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.High, 0.0), mVerticalAxis, false);
low = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Low, 0.0), mVerticalAxis, false);
}
/// <summary>
/// format a candle value to the parameter strings
/// </summary>
/// <param name="candleVal"></param>
/// <param name="fractionDigits"></param>
/// <param name="start"></param>
/// <param name="duration"></param>
public void FormatCandleValue(CandleChartData.CandleValue candleVal, int fractionDigits, out string start, out string duration)
{
start = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Open, 0.0), mHorizontalAxis, true);
duration = StringFromAxisFormat(new DoubleVector3(candleVal.Duration, candleVal.Open, 0.0), mHorizontalAxis, true);
}
/// <summary>
/// format a candle value to the parameter strings
/// </summary>
/// <param name="candleVal"></param>
/// <param name="fractionDigits"></param>
/// <param name="open"></param>
/// <param name="high"></param>
/// <param name="low"></param>
/// <param name="close"></param>
/// <param name="start"></param>
/// <param name="duration"></param>
public void FormatCandleValue(CandleChartData.CandleValue candleVal, int fractionDigits, out string open, out string high, out string low, out string close, out string start, out string duration)
{
FormatCandleValue(candleVal, fractionDigits, out open, out high, out low, out close);
FormatCandleValue(candleVal, fractionDigits, out start, out duration);
}
public class CandleEventArgs
{
int mType;
public CandleEventArgs(int index, int type, Rect selectionRect, Vector3 position, CandleChartData.CandleValue value, string category)
{
mType = type;
Position = position;
SelectionRect = selectionRect;
CandleValue = value;
Category = category;
}
/// <summary>
/// true if this event is triggered for the high portion of the candle
/// </summary>
public bool IsHighEvent { get { return mType == 0; } }
/// <summary>
/// true if this event is triggered for the low portion of the candle
/// </summary>
public bool IsLowEvent { get { return mType == 2; } }
/// <summary>
/// true if this event is triggerd for the body portion of the candle (open/close)
/// </summary>
public bool IsBodyEvent { get { return mType == 1; } }
/// <summary>
/// the rect on the canvas that represents the selected object
/// </summary>
public Rect SelectionRect { get; private set; }
/// <summary>
/// mouse position
/// </summary>
public Vector3 Position { get; private set; }
/// <summary>
/// the index of the candle in the data
/// </summary>
public int Index { get; private set; }
/// <summary>
/// the value of the candle
/// </summary>
public CandleChartData.CandleValue CandleValue { get; private set; }
/// <summary>
/// the category of the candle
/// </summary>
public string Category { get; private set; }
}
[SerializeField]
[Tooltip("Thickness mode for the candle chart")]
protected CandleThicknessMode thicknessMode = CandleThicknessMode.Constant;
/// <summary>
/// Thickness mode for the candle chart
/// </summary>
public CandleThicknessMode ThicknessMode
{
get { return thicknessMode; }
set
{
thicknessMode = value;
Invalidate();
}
}
protected override IChartData DataLink
{
get
{
return Data;
}
}
[SerializeField]
[Tooltip("Thickness contant for the candle chart , it's meaning depends on the thickness mode")]
protected float thicknessConstant = 10f;
/// <summary>
/// Thickness contant for the candle chart , it's meaning depends on the thickness mode\
/// Fill - multiply the duration size of the candle by a constant , should be between 0f to 1f
/// Constant - the pixel size of the candle
/// Proportional - constant size of the candle in seconds
/// </summary>
public float ThicknessConstant
{
get { return thicknessConstant; }
set
{
thicknessConstant = value;
Invalidate();
}
}
protected override float GetScrollingRange(int axis)
{
float min = (float)((IInternalCandleData)Data).GetMinValue(axis, false);
float max = (float)((IInternalCandleData)Data).GetMaxValue(axis, false);
return max - min;
}
[SerializeField]
[Tooltip("format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string itemFormat = "O:<?open>,H:<?high>,L:<?low>,C:<?close>";
/// <summary>
/// format with the following labels:
/// <?start>
/// <?duration>
/// <?open>
/// <?close>
/// <?high>
/// <?low>
/// </summary>
public string ItemFormat
{
get { return itemFormat; }
set
{
itemFormat = value;
Invalidate();
}
}
[SerializeField]
[Tooltip("Used when using hoverItem component, and the mouse is hovering over the body of the candle,format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string bodyFormat = "O:<?open>,C:<?close>";
/// <summary>
/// format with the following labels:
/// <?start>
/// <?duration>
/// <?open>
/// <?close>
/// <?high>
/// <?low>
/// </summary>
public string BodyFormat
{
get { return bodyFormat; }
set
{
bodyFormat = value;
Invalidate();
}
}
[SerializeField]
[Tooltip("Used when using hoverItem component, and the mouse is hovering over the high line of the candle,format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string highFormat = "H:<?high>";
public string HighFormat
{
get { return highFormat; }
set
{
highFormat = value;
Invalidate();
}
}
[SerializeField]
[Tooltip("Used when using hoverItem component, and the mouse is hovering over the low line of the candle,format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string lowFormat = "L:<?low>";
public string LowFormat
{
get { return lowFormat; }
set
{
lowFormat = value;
Invalidate();
}
}
/// <summary>
/// the candle chart data
/// </summary>
[HideInInspector]
[SerializeField]
protected CandleChartData Data = new CandleChartData();
/// <summary>
/// Holds the candle chart data. including values and categories
/// </summary>
public CandleChartData DataSource { get { return Data; } }
protected override void Start()
{
base.Start();
if (ChartCommon.IsInEditMode == false)
{
HookEvents();
}
Invalidate();
}
protected override void OnValidate()
{
base.OnValidate();
if (ChartCommon.IsInEditMode == false)
{
HookEvents();
}
Data.RestoreDataValues();
Invalidate();
}
/// <summary>
/// hooks data source events.
/// </summary>
protected void HookEvents()
{
((IInternalCandleData)Data).InternalDataChanged -= CandleChart_InternalDataChanged;
((IInternalCandleData)Data).InternalDataChanged += CandleChart_InternalDataChanged;
((IInternalCandleData)Data).InternalViewPortionChanged -= CandleChart_InternalViewPortionChanged;
((IInternalCandleData)Data).InternalViewPortionChanged += CandleChart_InternalViewPortionChanged;
((IInternalCandleData)Data).InternalRealTimeDataChanged -= CandleChart_InternalRealTimeDataChanged;
((IInternalCandleData)Data).InternalRealTimeDataChanged += CandleChart_InternalRealTimeDataChanged;
}
private void CandleChart_InternalViewPortionChanged(object sender, EventArgs e)
{
InvalidateRealtime();
}
private void CandleChart_InternalRealTimeDataChanged(int index,string str)
{
InvalidateRealtime();
}
private void CandleChart_InternalDataChanged(object sender, EventArgs e)
{
Invalidate();
}
protected override void OnLabelSettingChanged()
{
base.OnLabelSettingChanged();
Invalidate();
}
protected override void OnAxisValuesChanged()
{
base.OnAxisValuesChanged();
Invalidate();
}
protected override void OnLabelSettingsSet()
{
base.OnLabelSettingsSet();
Invalidate();
}
protected override LegenedData LegendInfo
{
get
{
LegenedData data = new LegenedData();
if (Data == null)
return data;
foreach (var cat in ((IInternalCandleData)Data).Categories)
{
for (int i = 0; i < 2; i++)
{
LegenedData.LegenedItem item = new LegenedData.LegenedItem();
CandleChartData.CandleSettings settings = cat.UpCandle;
if (i == 0)
{
item.Name = cat.Name + " Increasing";
}
else
{
item.Name = cat.Name + " Decreasing";
settings = cat.DownCandle;
}
if (settings.Fill != null)
item.Material = settings.Fill;
else
{
if (settings.Outline != null)
item.Material = settings.Outline;
else
item.Material = settings.Line;
}
data.AddLegenedItem(item);
}
}
return data;
}
}
protected override bool SupportsCategoryLabels
{
get
{
return true;
}
}
protected override bool SupportsGroupLables
{
get
{
return false;
}
}
protected override bool SupportsItemLabels
{
get
{
return true;
}
}
protected override bool HasValues(AxisBase axis)
{
if (axis == mVerticalAxis || axis == mHorizontalAxis) // has both horizontal and vertical axis
return true;
return false;
}
protected override double MaxValue(AxisBase axis)
{
if (axis == null)
return 0.0;
if (axis == mHorizontalAxis)
return ((IInternalCandleData)Data).GetMaxValue(0, false);
if (axis == mVerticalAxis)
return ((IInternalCandleData)Data).GetMaxValue(1, false);
return 0.0;
}
protected override double MinValue(AxisBase axis)
{
if (axis == null)
return 0.0;
if (axis == mHorizontalAxis)
return ((IInternalCandleData)Data).GetMinValue(0, false);
if (axis == mVerticalAxis)
return ((IInternalCandleData)Data).GetMinValue(1, false);
return 0.0;
}
void Deflate(ref double start, ref double duration, double amount)
{
double center = start + duration * 0.5;
duration *= amount;
start = center - duration * 0.5;
}
CandleChartData.CandleValue NormalizeCandle(CandleChartData.CandleValue candle, DoubleVector3 min, DoubleVector3 range)
{
CandleChartData.CandleValue res = new CandleChartData.CandleValue();
res.Open = ChartCommon.normalizeInRangeY(candle.Open, min, range);
res.Close = ChartCommon.normalizeInRangeY(candle.Close, min, range);
res.High = ChartCommon.normalizeInRangeY(candle.High, min, range);
res.Low = ChartCommon.normalizeInRangeY(candle.Low, min, range);
double duration = candle.Duration;
double start = candle.Start;
if (ThicknessMode == CandleThicknessMode.Fill)
Deflate(ref start, ref duration, ThicknessConstant);
else if (thicknessMode == CandleThicknessMode.Proportional)
Deflate(ref start, ref duration, ThicknessConstant / duration);
double candleEnd = start + duration;
candleEnd = ChartCommon.normalizeInRangeX(candleEnd, min, range);
res.Start = ChartCommon.normalizeInRangeX(start, min, range);
res.Duration = candleEnd - res.Start;
return res;
}
public CandleChartData.CandleValue InterpolateCandleInRect(CandleChartData.CandleValue candle, Rect viewRect)
{
CandleChartData.CandleValue res = new CandleChartData.CandleValue();
res.Open = ChartCommon.interpolateInRectY(viewRect, candle.Open);
res.Close = ChartCommon.interpolateInRectY(viewRect, candle.Close);
res.High = ChartCommon.interpolateInRectY(viewRect, candle.High);
res.Low = ChartCommon.interpolateInRectY(viewRect, candle.Low);
if (res.High < res.Low)
{
double tmp = res.High;
res.High = res.Low;
res.Low = tmp;
tmp = res.Open;
res.Open = res.Close;
res.Close = tmp;
}
double candleEnd = candle.Start + candle.Duration;
candleEnd = ChartCommon.interpolateInRectX(viewRect, candleEnd);
double start = ChartCommon.interpolateInRectX(viewRect, candle.Start);
double duration = candleEnd - start;
if (start > candleEnd)
{
double tmp = start;
start = candleEnd;
candleEnd = tmp;
}
if (ThicknessMode == CandleThicknessMode.Constant)
{
Deflate(ref start, ref duration, ThicknessConstant / duration);
}
res.Start = start;
res.Duration = duration;
return res;
}
StringBuilder mTmpBuilder = new StringBuilder();
protected string FormatItemWithFormat(string format, string open, string close, string high, string low, string start, string duration)
{
FormatItemWithFormat(mTmpBuilder, format, open, close, high, low, start, duration);
return mTmpBuilder.ToString();
}
public string FormatItem(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(itemFormat, open, close, high, low, start, duration);
}
public string FormatLow(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(lowFormat, open, close, high, low, start, duration);
}
public string FormatHigh(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(highFormat, open, close, high, low, start, duration);
}
public string FormatBody(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(bodyFormat, open, close, high, low, start, duration);
}
protected void FormatItem(StringBuilder builder, string open, string close, string high, string low, string start, string duration)
{
FormatItemWithFormat(builder, itemFormat, open, close, high, low, start, duration);
}
protected void FormatItemWithFormat(StringBuilder builder, string format, string open, string close, string high, string low, string start, string duration)
{
builder.Length = 0;
builder.Append(format);
builder.Replace("<?open>", open).Replace("<?close>", close).Replace("<?high>", high).Replace("<?low>", low).Replace("<?start>", start).Replace("<?duration>", duration);
}
protected void TransformCandles(IList<CandleChartData.CandleValue> candles, List<CandleChartData.CandleValue> output, Rect viewRect, DoubleVector3 min, DoubleVector3 max)
{
DoubleVector3 range = max - min;
if (Math.Abs(range.x) <= 0.0001f || Math.Abs(range.y) < 0.0001f)
return;
output.Clear();
for (int i = 0; i < candles.Count; i++)
{
CandleChartData.CandleValue candle = candles[i];
candle = InterpolateCandleInRect(NormalizeCandle(candle, min, range), viewRect);
output.Add(candle);
}
}
protected int ClipCandles(IList<CandleChartData.CandleValue> candles, List<CandleChartData.CandleValue> result)
{
result.Clear();
double minX, minY, maxX, maxY, xScroll, yScroll, xSize, ySize, xOut;
GetScrollParams(out minX, out minY, out maxX, out maxY, out xScroll, out yScroll, out xSize, out ySize, out xOut);
double direction = 1.0;
if (minX > maxX)
direction = -1.0;
bool prevOut = true;
int refrenceIndex = 0;
for (int i = 0; i < candles.Count; i++)
{
CandleChartData.CandleValue candle = candles[i];
double candleEnd = candle.Duration + candle.Start;
if (candleEnd* direction >= xScroll* direction && candle.Start* direction <= xOut* direction) // if the candle is within range
{
if (prevOut)
{
refrenceIndex = i;
prevOut = false;
}
result.Add(candle);
}
}
return refrenceIndex;
}
protected override void OnNonHoverted()
{
base.OnNonHoverted();
if (NonHovered != null)
NonHovered.Invoke();
}
protected override void OnItemSelected(object userData)
{
base.OnItemSelected(userData);
CandleEventArgs args = userData as CandleEventArgs;
if (CandleClicked != null)
CandleClicked.Invoke(args);
}
protected override void OnItemHoverted(object userData)
{
base.OnItemHoverted(userData);
CandleEventArgs args = userData as CandleEventArgs;
if (CandleHovered != null)
CandleHovered.Invoke(args);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8205d387a1db4a04c85ed37decb56caf
timeCreated: 1491152606
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,657 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
[Serializable]
public class CandleChartData : ScrollableChartData, IInternalCandleData
{
[Serializable]
public struct CandleValue
{
public CandleValue(double open, double high, double low, double close, DateTime start, TimeSpan duration)
{
Open = open;
High = high;
Low = low;
Close = close;
Start = ChartDateUtility.DateToValue(start);
Duration = ChartDateUtility.TimeSpanToValue(duration);
}
public CandleValue(double open, double high, double low, double close, double start, double duration)
{
Open = open;
High = high;
Low = low;
Close = close;
Start = start;
Duration = duration;
}
public double Open;
public double High;
public double Low;
public double Close;
public double Start;
public double Duration;
public bool isUp
{
get { return Close > Open; }
}
public double End
{
get { return Start + Duration; }
}
public DoubleVector2 MidPoint
{
get { return new DoubleVector2(Start + (Duration * 0.5), (Open + Close) * 0.5); }
}
public double Max
{
get
{
return Math.Max(Open, Close);
}
}
public double LowBound
{
get
{
return Math.Min(Math.Min(High, Low), Math.Min(Open, Close));
}
}
public double HighBound
{
get
{
return Math.Max(Math.Max(High, Low), Math.Max(Open, Close));
}
}
public double Min
{
get
{
return Math.Min(Open, Close);
}
}
}
[Serializable]
public class CandleSettings
{
public double LineThickness = 2.0;
public double CandleThicknessMultiplier = 1.0;
public double OutlineThickness = 0.0;
public ChartItemEffect CandleHoverPrefab;
public Material Outline;
public Material Line;
public Material Fill;
public GameObject CandlePrefab;
}
[Serializable]
public class CategoryData : BaseScrollableCategoryData
{
public List<CandleValue> Data = new List<CandleValue>();
public CandleSettings UpCandle = new CandleSettings();
public CandleSettings DownCandle = new CandleSettings();
public double Depth = 0f;
}
class CandleComparer : IComparer<CandleValue>
{
public int Compare(CandleValue x, CandleValue y)
{
if (x.Open < y.Open)
return -1;
if (x.Open > y.Open)
return 1;
return 0;
}
}
[Serializable]
class SerializedCategory
{
public string Name;
[HideInInspector]
public CandleValue[] Data;
[HideInInspector]
public double? MaxX, MaxY, MinX, MinY;
public CandleSettings UpCandle = new CandleSettings();
public CandleSettings DownCandle = new CandleSettings();
public double Depth = 0f;
}
CandleComparer mComparer = new CandleComparer();
[SerializeField]
SerializedCategory[] mSerializedData = new SerializedCategory[0];
event EventHandler IInternalCandleData.InternalViewPortionChanged
{
add
{
ViewPortionChanged += value;
}
remove
{
ViewPortionChanged -= value;
}
}
event EventHandler IInternalCandleData.InternalDataChanged
{
add
{
DataChanged += value;
}
remove
{
DataChanged -= value;
}
}
/// <summary>
/// rename a category. throws and exception on error
/// </summary>
/// <param name="prevName"></param>
/// <param name="newName"></param>
public void RenameCategory(string prevName, string newName)
{
if (prevName == newName)
return;
if (mData.ContainsKey(newName))
throw new ArgumentException(String.Format("A category named {0} already exists", newName));
CategoryData cat = (CategoryData)mData[prevName];
mData.Remove(prevName);
cat.Name = newName;
mData.Add(newName, cat);
RaiseDataChanged();
}
/// <summary>
/// Adds a new category to the candle chart.
/// </summary>
/// <param name="category"></param>
/// <param name="material"></param>
/// <param name="innerFill"></param>
public void AddCategory(string category, CandleSettings up, CandleSettings down, double depth)
{
AddCategory3DCandle(category, up, down, 0f);
}
/// <summary>
/// add category to the candle chart
/// </summary>
/// <param name="category"></param>
/// <param name="up"></param>
/// <param name="down"></param>
/// <param name="depth"></param>
public void AddCategory3DCandle(string category, CandleSettings up, CandleSettings down, double depth)
{
if (mData.ContainsKey(category))
throw new ArgumentException(String.Format("A category named {0} already exists", category));
CategoryData data = new CategoryData();
mData.Add(category, data);
data.Name = category;
data.DownCandle = down;
data.UpCandle = up;
data.Depth = depth;
RaiseDataChanged();
}
/// <summary>
/// removed a category from the DataSource. returnes true on success , or false if the category does not exist
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public bool RemoveCategory(string category)
{
return mData.Remove(category);
}
public void SetDownCandle(string category, CandleSettings down)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
data.DownCandle = down;
RaiseDataChanged();
}
public void SetUpCandle(string category, CandleSettings up)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
data.UpCandle = up;
RaiseDataChanged();
}
/// <summary>
/// sets the depth for a 3d graph category
/// </summary>
/// <param name="category"></param>
/// <param name="depth"></param>
public void Set3DCategoryDepth(string category, double depth)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
if (depth < 0)
depth = 0f;
CategoryData data = (CategoryData)mData[category];
data.Depth = depth;
RaiseDataChanged();
}
/// <summary>
/// clears all the data for the selected category
/// </summary>
/// <param name="category"></param>
public void ClearCategory(string category)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
mData[category].MaxX = null;
mData[category].MaxY = null;
mData[category].MinX = null;
mData[category].MinY = null;
((CategoryData)mData[category]).Data.Clear();
RaiseDataChanged();
}
/// <summary>
/// gets the candle at the specified index for a given category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
/// <returns></returns>
public int GetCandleCount(string category)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return 0;
}
CategoryData data = (CategoryData)mData[category];
return data.Data.Count;
}
/// <summary>
/// gets the candle at the specified index for a given category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
/// <returns></returns>
public CandleValue GetCandle(string category, int index)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return new CandleValue();
}
CategoryData data = (CategoryData)mData[category];
return data.Data[index];
}
/// <summary>
/// returns the total amount of candles in the given category
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public int GetTotalCandlesInCategory(string category)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return 0;
}
CategoryData data = (CategoryData)mData[category];
return data.Data.Count;
}
/// <summary>
/// use this to modify candles in realtime.
/// </summary>
/// <param name="category"></param>
/// <param name="candle"></param>
public void ModifyCandleInCategory(string category, int candleIndex, double open, double high, double low, double close)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
List<CandleValue> candles = data.Data;
if (candleIndex == -1)
candleIndex = data.Data.Count - 1;
if (candleIndex < 0 || candleIndex >= candles.Count)
{
Debug.LogWarning("Candle index is out of range, call is ignored");
return;
}
double candleMax = Math.Max(Math.Max(open, close), Math.Max(high, low));
double candleMin = Math.Min(Math.Min(open, close), Math.Min(high, low));
if (data.MaxY.HasValue == false || data.MaxY.Value < candleMax)
data.MaxY = candleMax;
if (data.MinY.HasValue == false || data.MinY.Value > candleMin)
data.MinY = candleMin;
CandleValue candle = data.Data[candleIndex];
candle.Open = open;
candle.Close = close;
candle.High = high;
candle.Low = low;
data.Data[candleIndex] = candle;
RaiseRealtimeDataChanged(candleIndex, category);
}
/// <summary>
/// removes a candle from a category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
public void RemoveCandleInCategory(string category, int candleIndex)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
List<CandleValue> candles = data.Data;
if (candleIndex < 0 || candleIndex >= candles.Count)
{
Debug.LogWarning("Candle index is out of range, call is ignored");
return;
}
data.Data.RemoveAt(candleIndex);
RaiseRealtimeDataChanged(candleIndex, category);
}
/// <summary>
/// use this to modify candles in realtime. this overload modifies the last candle and can be used for realtime candle data stream
/// </summary>
/// <param name="category"></param>
/// <param name="candle"></param>
public void ModifyLastCandleInCategory(string category, double open, double high, double low, double close)
{
ModifyCandleInCategory(category, -1, open, high, low, close);
}
class Slider : BaseSlider
{
public string category;
public double from;
public int index;
public double to;
public double current;
public double y;
private CandleChartData mParent;
public Slider(CandleChartData parent)
{
mParent = parent;
}
public override DoubleVector2 Max
{
get
{
return new DoubleVector2(current, y);
}
}
public override DoubleVector2 Min
{
get
{
return new DoubleVector2(current, y);
}
}
public override string Category { get { return category; } }
public override int MinIndex
{
get { return index; }
}
public override bool Update()
{
BaseScrollableCategoryData baseData;
if (mParent.mData.TryGetValue(category, out baseData) == false)
return true;
double time = Time.time;
time -= StartTime;
if (Duration <= 0.0001f)
time = 1f;
else
{
time /= Duration;
Math.Max(0.0, Math.Min(time, 1.0));
}
current = from * (1.0 - time) + to * time;
if (time >= 1f)
{
mParent.ModifyMinMax(baseData, new DoubleVector3(current, y, 0.0));
return true;
}
return false;
}
}
/// <summary>
/// adds a point to the category. The points are sorted by their x value automatically
/// </summary>
/// <param name="category"></param>
/// <param name="point"></param>
public void AddCandleToCategory(string category, CandleValue candle, float autoScrollSlideTime = 0f)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
List<CandleValue> candles = data.Data;
double start = candle.Start;
double end = candle.Start + candle.Duration;
double candleMax = Math.Max(Math.Max(candle.Open, candle.Close), Math.Max(candle.High, candle.Low));
double candleMin = Math.Min(Math.Min(candle.Open, candle.Close), Math.Min(candle.High, candle.Low));
if (autoScrollSlideTime <= 0f)
{
if (data.MaxX.HasValue == false || data.MaxX.Value < end)
data.MaxX = end;
}
if (data.MinX.HasValue == false || data.MinX.Value > start)
data.MinX = start;
if (data.MaxY.HasValue == false || data.MaxY.Value < candleMax)
data.MaxY = candleMax;
if (data.MinY.HasValue == false || data.MinY.Value > candleMin)
data.MinY = candleMin;
if (candles.Count > 0)
{
if (candles[candles.Count - 1].Start < candle.Start)
{
if (autoScrollSlideTime > 0f)
{
Slider s = new Slider(this);
s.category = category;
s.from = candles[candles.Count - 1].End;
s.to = end;
s.StartTime = Time.time;
s.Duration = autoScrollSlideTime;
s.y = (candleMax + candleMin) * 0.5;
s.index = candles.Count - 1;
mSliders.Add(s);
}
candles.Add(candle);
RaiseRealtimeDataChanged(candles.Count-1, category);
return;
}
}
int search = candles.BinarySearch(candle, mComparer);
if (search < 0)
search = ~search;
candles.Insert(search, candle);
RaiseRealtimeDataChanged(search, category);
}
double IInternalCandleData.GetMaxValue(int axis, bool dataValue)
{
return GetMaxValue(axis, dataValue);
}
double IInternalCandleData.GetMinValue(int axis, bool dataValue)
{
return GetMinValue(axis, dataValue);
}
public override void OnAfterDeserialize()
{
if (mSerializedData == null)
return;
mData.Clear();
mSuspendEvents = true;
for (int i = 0; i < mSerializedData.Length; i++)
{
SerializedCategory cat = mSerializedData[i];
if (cat.Depth < 0)
cat.Depth = 0f;
string name = cat.Name;
AddCategory3DCandle(name, cat.UpCandle, cat.DownCandle, cat.Depth);
CategoryData data = (CategoryData)mData[name];
data.Data.AddRange(cat.Data);
data.MaxX = cat.MaxX;
data.MaxY = cat.MaxY;
data.MinX = cat.MinX;
data.MinY = cat.MinY;
}
mSuspendEvents = false;
}
public override void OnBeforeSerialize()
{
List<SerializedCategory> serialized = new List<SerializedCategory>();
foreach (KeyValuePair<string, CategoryData> pair in mData.Select(x => new KeyValuePair<string, CategoryData>(x.Key, (CategoryData)x.Value)))
{
SerializedCategory cat = new SerializedCategory();
cat.Name = pair.Key;
cat.MaxX = pair.Value.MaxX;
cat.MinX = pair.Value.MinX;
cat.MaxY = pair.Value.MaxY;
cat.MinY = pair.Value.MinY;
cat.UpCandle = pair.Value.UpCandle;
cat.DownCandle = pair.Value.DownCandle;
cat.Depth = pair.Value.Depth;
cat.Data = pair.Value.Data.ToArray();
if (cat.Depth < 0)
cat.Depth = 0f;
serialized.Add(cat);
}
mSerializedData = serialized.ToArray();
}
public override BaseScrollableCategoryData GetDefaultCategory()
{
throw new NotImplementedException();
}
protected override void InnerClearCategory(string category)
{
throw new NotImplementedException();
}
protected override void AppendDatum(string category, MixedSeriesGenericValue value)
{
throw new NotImplementedException();
}
protected override void AppendDatum(string category, IList<MixedSeriesGenericValue> value)
{
throw new NotImplementedException();
}
protected override bool AddCategory(string category, BaseScrollableCategoryData data)
{
throw new NotImplementedException();
}
int IInternalCandleData.TotalCategories
{
get { return mData.Count; }
}
event Action<int,string> IInternalCandleData.InternalRealTimeDataChanged
{
add
{
RealtimeDataChanged += value;
}
remove
{
RealtimeDataChanged -= value;
}
}
IEnumerable<CategoryData> IInternalCandleData.Categories
{
get
{
return mData.Values.Select(x => (CategoryData)x);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e8db3da49553a7d449f2082158192d56
timeCreated: 1491152608
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,136 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
class CanvasCandle : MonoBehaviour, ICandleCreator
{
List<CandleChartData.CandleValue> mEmptyCandle = new List<CandleChartData.CandleValue>();
HashSet<CanvasCandleGraphic> mOccupied = new HashSet<CanvasCandleGraphic>();
CanvasCandleGraphic mCandle, mLine;
CanvasCandleGraphic mOutline;
/// <summary>
/// The selected index is hovered about the specified point
/// </summary>
public event EventHandlingGraphic.GraphicEvent Hover;
/// <summary>
/// The selected index is clicked about the specified point
/// </summary>
public event EventHandlingGraphic.GraphicEvent Click;
/// <summary>
/// The currently hovered and selected objects are no longer selected or hovered.
/// </summary>
public event Action Leave;
private CanvasCandleGraphic CreateCandleGraphic()
{
GameObject obj = ChartCommon.CreateCanvasChartItem();
CanvasCandleGraphic graphic = obj.AddComponent<CanvasCandleGraphic>();
graphic.maskable = true;
RectTransform rect = obj.GetComponent<RectTransform>();
rect.SetParent(transform, false);
rect.anchoredPosition = Vector3.zero;
rect.rotation = Quaternion.identity;
rect.localScale = new Vector3(1f, 1f, 1f);
HookEventsForGraphic(graphic);
return graphic;
}
void HookEventsForGraphic(CanvasCandleGraphic graphic)
{
graphic.Hover += (index, type, data, position) => { Candle_Hover(graphic, index, type, data, position); };
graphic.Click += (index, type, data, position) => { Candle_Click(graphic, index, type, data, position); }; ;
graphic.Leave += () => { Candle_Leave(graphic); };
}
public void Clear()
{
ChartCommon.SafeDestroy(mCandle);
ChartCommon.SafeDestroy(mLine);
ChartCommon.SafeDestroy(mOutline);
}
public void SetRefrenceIndex(int index)
{
if (mCandle != null)
mCandle.SetRefrenceIndex(index);
if (mLine != null)
mCandle.SetRefrenceIndex(index);
if (mOutline != null)
mOutline.SetRefrenceIndex(index);
}
public void Generate(CandleChart parent, Rect viewRect, IList<CandleChartData.CandleValue> value, CandleChartData.CandleSettings settings)
{
if (parent.IsCanvas == false)
{
Debug.LogWarning("prefab is meant to be used with canvas candle chart only");
return;
}
if (mCandle == null)
mCandle = CreateCandleGraphic();
if (settings.Fill == null || settings.CandleThicknessMultiplier < 0.0001f)
mCandle.SetCandle(0, mEmptyCandle, settings);
else
mCandle.SetCandle(0, value, settings);
mCandle.HoverTransform(transform);
mCandle.SetViewRect(viewRect, new Rect());
mCandle.SetHoverPrefab(settings.CandleHoverPrefab);
mCandle.material = settings.Fill;
if (mLine == null)
mLine = CreateCandleGraphic();
if (settings.Line == null || settings.LineThickness < 0.0001f)
mLine.SetCandle(1, mEmptyCandle, settings);
else
mLine.SetCandle(1, value, settings);
mLine.HoverTransform(transform);
mLine.SetHoverPrefab(settings.CandleHoverPrefab);
mLine.material = settings.Line;
mLine.SetViewRect(viewRect, new Rect());
if (mOutline == null)
mOutline = CreateCandleGraphic();
mOutline.material = settings.Outline;
mOutline.SetViewRect(viewRect, new Rect());
if (settings.Outline == null || settings.OutlineThickness < 0.0001f)
mOutline.SetCandle(2, mEmptyCandle, settings);
else
mOutline.SetCandle(2, value, settings);
}
private void Candle_Leave(CanvasCandleGraphic graphic)
{
if (mOccupied.Remove(graphic))
{
if (mOccupied.Count == 0)
{
if (Leave != null)
Leave();
}
}
}
private void Candle_Click(CanvasCandleGraphic graphic, int index, int type, object data, Vector2 position)
{
mOccupied.Add(graphic);
position = graphic.transform.TransformPoint(position);
if (Click != null)
Click(index, type, data, position);
}
private void Candle_Hover(CanvasCandleGraphic graphic, int index, int type, object data, Vector2 position)
{
mOccupied.Add(graphic);
position = graphic.transform.TransformPoint(position);
if (Hover != null)
Hover(index, type, data, position);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 663704866ea20c443b89affc7c7efb2f
timeCreated: 1491395378
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,548 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
class CanvasCandleChart : CandleChart
{
List<CandleChartData.CandleValue> mClipped = new List<CandleChartData.CandleValue>();
List<CandleChartData.CandleValue> mTransformed = new List<CandleChartData.CandleValue>();
List<CandleChartData.CandleValue> mCurrentSeries = new List<CandleChartData.CandleValue>();
int mTmpCurrentIndex = 0;
List<int> mUpToIndex = new List<int>();
List<int> mDownToIndex = new List<int>();
Dictionary<string, CategoryObject> mCategoryObjects = new Dictionary<string, CategoryObject>();
StringBuilder mRealtimeStringBuilder = new StringBuilder();
HashSet<string> mOccupiedCateogies = new HashSet<string>();
List<int> mTmpToRemove = new List<int>();
private bool SupressRealtimeGeneration = false;
[SerializeField]
private bool fitToContainer = false;
public bool FitToContainer
{
get { return fitToContainer; }
set
{
fitToContainer = value;
OnPropertyUpdated();
}
}
[SerializeField]
private ChartMagin fitMargin;
public ChartMagin FitMargin
{
get { return fitMargin; }
set
{
fitMargin = value;
OnPropertyUpdated();
}
}
protected override float TotalDepthLink
{
get
{
return 0f;
}
}
public override bool SupportRealtimeGeneration
{
get
{
return true;
}
}
public override bool IsCanvas
{
get
{
return true;
}
}
class CategoryObject
{
public CanvasChartMesh mItemLabels;
public CanvasCandle mUp;
public CanvasCandle mDown;
public Dictionary<int, string> mCahced = new Dictionary<int, string>();
public HashSet<CanvasCandle> mOccupiedCandles = new HashSet<CanvasCandle>();
private CanvasCandleChart mParent;
/// <summary>
/// The selected index is hovered about the specified point
/// </summary>
public event EventHandlingGraphic.GraphicEvent Hover;
/// <summary>
/// The selected index is clicked about the specified point
/// </summary>
public event EventHandlingGraphic.GraphicEvent Click;
/// <summary>
/// The currently hovered and selected objects are no longer selected or hovered.
/// </summary>
public event Action Leave;
public CategoryObject(CanvasCandleChart parent)
{
mParent = parent;
}
public void HookEvents()
{
HookEvents(mUp, true);
HookEvents(mDown, false);
}
void HookEvents(CanvasCandle candle, bool isUp)
{
if (candle == null)
return;
candle.Leave += () => mLeave(candle);
candle.Hover += (index, type, data, position) => { mHover(candle, mParent.MapIndex(index, isUp), type, data, position); };
candle.Click += (index, type, data, position) => { mClick(candle, mParent.MapIndex(index, isUp), type, data, position); };
}
private void mClick(CanvasCandle candle, int index, int type, object data, Vector2 position)
{
mOccupiedCandles.Add(candle);
if (Click != null)
Click(index, type, data, position);
}
private void mHover(CanvasCandle candle, int index, int type, object data, Vector2 position)
{
mOccupiedCandles.Add(candle);
if (Hover != null)
Hover(index, type, data, position);
}
private void mLeave(CanvasCandle candle)
{
if (mOccupiedCandles.Remove(candle))
{
if (mOccupiedCandles.Count == 0)
{
if (Leave != null)
Leave();
}
}
}
}
protected override bool ShouldFitCanvas { get { return true; } }
protected override FitType FitAspectCanvas
{
get
{
return FitType.Aspect;
}
}
private CanvasCandle CreateDataObject(CandleChartData.CategoryData data, GameObject rectMask)
{
GameObject obj = new GameObject("Candles", typeof(RectTransform));
ChartCommon.HideObject(obj, hideHierarchy);
obj.AddComponent<ChartItem>();
RectTransform t = obj.GetComponent<RectTransform>();
obj.AddComponent<CanvasRenderer>();
CanvasCandle candles = obj.AddComponent<CanvasCandle>();
t.SetParent(rectMask.transform, false);
t.localScale = new Vector3(1f, 1f, 1f);
t.anchorMin = new Vector2(0f, 0f);
t.anchorMax = new Vector2(1f, 1f);
t.sizeDelta = new Vector2(0f, 0f);
t.anchorMin = new Vector2(0f, 0f);
t.anchorMax = new Vector2(0f, 0f);
t.anchoredPosition = Vector3.zero;
return candles;
}
protected override double GetCategoryDepth(string category)
{
return 0.0;
}
public override void GenerateRealtime()
{
if (SupressRealtimeGeneration)
return;
base.GenerateRealtime();
double minX = ((IInternalCandleData)Data).GetMinValue(0, false);
double minY = ((IInternalCandleData)Data).GetMinValue(1, false);
double maxX = ((IInternalCandleData)Data).GetMaxValue(0, false);
double maxY = ((IInternalCandleData)Data).GetMaxValue(1, false);
double xScroll = GetScrollOffset(0);
double yScroll = GetScrollOffset(1);
double xSize = maxX - minX;
double ySize = maxY - minY;
double xOut = minX + xScroll + xSize;
double yOut = minY + yScroll + ySize;
DoubleVector3 min = new DoubleVector3(xScroll + minX, yScroll + minY);
DoubleVector3 max = new DoubleVector3(xOut, yOut);
Rect viewRect = new Rect(0f, 0f, widthRatio, heightRatio);
ClearBillboardCategories();
bool edit = false;
foreach (CandleChartData.CategoryData data in ((IInternalCandleData)Data).Categories)
{
CategoryObject obj = null;
if (mCategoryObjects.TryGetValue(data.Name, out obj) == false)
continue;
mClipped.Clear();
mTransformed.Clear();
int refrenceIndex = ClipCandles(data.Data, mClipped);
TransformCandles(mClipped, mTransformed, viewRect, min, max);
if (data.Data.Count == 0 && ChartCommon.IsInEditMode)
{
edit = true;
}
mTmpToRemove.Clear();
int range = refrenceIndex + mClipped.Count;
foreach (int key in obj.mCahced.Keys)
{
if (key < refrenceIndex || key > range)
mTmpToRemove.Add(key);
}
for (int i = 0; i < mTmpToRemove.Count; i++)
obj.mCahced.Remove(mTmpToRemove[i]);
obj.mCahced.Remove(data.Data.Count - 1); // never store the last point cache , it might be intepolating by the realtime feature
if (data.Data.Count == 0)
continue;
GenerateItemLabels(true, obj, data, viewRect, refrenceIndex, edit);
if (obj.mUp != null)
{
FillCurrentSeries(true, refrenceIndex);
obj.mUp.Generate(this, viewRect, mCurrentSeries, data.UpCandle);
}
if (obj.mDown != null)
{
FillCurrentSeries(false, refrenceIndex);
obj.mDown.Generate(this, viewRect, mCurrentSeries, data.DownCandle);
}
}
}
protected override void ClearChart()
{
base.ClearChart();
ClearBillboard();
mActiveTexts.Clear();
mCategoryObjects.Clear();
}
void GenerateItemLabels(bool realTime, CategoryObject categoryObj, CandleChartData.CategoryData data, Rect viewRect, int refrenceIndex, bool edit)
{
if (mItemLabels != null && mItemLabels.isActiveAndEnabled)
{
CanvasChartMesh m = null;
if (realTime)
{
m = categoryObj.mItemLabels;
if (m == null)
return;
m.Clear();
}
else
{
m = new CanvasChartMesh(true);
m.RecycleText = true;
categoryObj.mItemLabels = m;
}
Rect textRect = viewRect;
textRect.xMin -= 1f;
textRect.yMin -= 1f;
textRect.xMax += 1f;
textRect.yMax += 1f;
for (int i = 0; i < mTransformed.Count; i++)
{
Vector2 pointValue = mTransformed[i].MidPoint.ToVector2();
if (textRect.Contains(pointValue) == false)
continue;
CandleChartData.CandleValue candleVal = mTransformed[i];
int candleIndex = i + refrenceIndex;
if (edit == false)
candleVal = data.Data[i + refrenceIndex];
Vector3 labelPos = ((Vector3)pointValue) + new Vector3(mItemLabels.Location.Breadth, mItemLabels.Seperation, mItemLabels.Location.Depth);
if (mItemLabels.Alignment == ChartLabelAlignment.Base)
labelPos.y -= (float)mTransformed[i].MidPoint.y;
string toSet;
if (realTime == false || categoryObj.mCahced.TryGetValue(candleIndex, out toSet) == false)
{
string Open = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Open, 0.0), mVerticalAxis, false);
string Close = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Close, 0.0), mVerticalAxis, false);
string High = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.High, 0.0), mVerticalAxis, false);
string Low = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Low, 0.0), mVerticalAxis, false);
string Start = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Open, 0.0), mHorizontalAxis, true);
string Duration = StringFromAxisFormat(new DoubleVector3(candleVal.Duration, candleVal.Open, 0.0), mHorizontalAxis, true);
FormatItem(mRealtimeStringBuilder, Open, Close, High, Low, Start, Duration);
toSet = mItemLabels.TextFormat.Format(mRealtimeStringBuilder.ToString(), data.Name, "");
categoryObj.mCahced[candleIndex] = toSet;
}
labelPos -= new Vector3(CanvasFitOffset.x * TotalWidth, CanvasFitOffset.y * TotalHeight, 0f);
BillboardText billboard = m.AddText(this, mItemLabels.TextPrefab, transform, mItemLabels.FontSize, mItemLabels.FontSharpness, toSet, labelPos.x, labelPos.y, labelPos.z, 0f, null);
TextController.AddText(billboard);
AddBillboardText(data.Name, i + refrenceIndex, billboard);
}
if (realTime)
{
m.DestoryRecycled();
if (m.TextObjects != null)
{
foreach (BillboardText text in m.TextObjects)
{
((IInternalUse)this).InternalTextController.AddText(text);
}
}
}
}
}
bool UpPredicate(CandleChartData.CandleValue x)
{
if (x.isUp)
mUpToIndex.Add(mTmpCurrentIndex);
mTmpCurrentIndex++;
return x.isUp;
}
bool DownPredicate(CandleChartData.CandleValue x)
{
if (x.isUp == false)
mDownToIndex.Add(mTmpCurrentIndex);
mTmpCurrentIndex++;
return !x.isUp;
}
void FillCurrentSeries(bool isUp, int refrenceIndex)
{
mTmpCurrentIndex = refrenceIndex;
mCurrentSeries.Clear();
if (isUp)
{
mUpToIndex.Clear();
mCurrentSeries.AddRange(mTransformed.Where(UpPredicate));
}
else
{
mDownToIndex.Clear();
mCurrentSeries.AddRange(mTransformed.Where(DownPredicate));
}
}
int MapIndex(int index, bool isUp)
{
if (isUp)
{
if (mUpToIndex.Count <= index)
return index;
return mUpToIndex[index];
}
if (mDownToIndex.Count <= index)
return index;
return mDownToIndex[index];
}
public override void InternalGenerateChart()
{
if (gameObject.activeInHierarchy == false)
return;
base.InternalGenerateChart();
if (FitToContainer)
{
RectTransform trans = GetComponent<RectTransform>();
widthRatio = trans.rect.width;
heightRatio = trans.rect.height;
}
ClearChart();
if (Data == null)
return;
GenerateAxis(true);
double minX = ((IInternalCandleData)Data).GetMinValue(0, false);
double minY = ((IInternalCandleData)Data).GetMinValue(1, false);
double maxX = ((IInternalCandleData)Data).GetMaxValue(0, false);
double maxY = ((IInternalCandleData)Data).GetMaxValue(1, false);
double xScroll = GetScrollOffset(0);
double yScroll = GetScrollOffset(1);
double xSize = maxX - minX;
double ySize = maxY - minY;
double xOut = minX + xScroll + xSize;
double yOut = minY + yScroll + ySize;
DoubleVector3 min = new DoubleVector3(xScroll + minX, yScroll + minY);
DoubleVector3 max = new DoubleVector3(xOut, yOut);
Rect viewRect = new Rect(0f, 0f, widthRatio, heightRatio);
int total = ((IInternalCandleData)Data).TotalCategories + 1;
bool edit = false;
ClearBillboard();
mActiveTexts.Clear();
int index = 0;
GameObject mask = CreateRectMask(viewRect);
foreach (CandleChartData.CategoryData data in ((IInternalCandleData)Data).Categories)
{
mClipped.Clear();
mTransformed.Clear();
int refrenceIndex = ClipCandles(data.Data, mClipped);
TransformCandles(mClipped, mTransformed, viewRect, min, max);
if (data.Data.Count == 0 && ChartCommon.IsInEditMode)
{
int tmpIndex = total - 1 - index;
float low = (((float)tmpIndex) / (float)total);
float high = (((float)tmpIndex + 1) / (float)total);
float y1 = Mathf.Lerp(high, low, 0.6f);
float y2 = Mathf.Lerp(high, low, 0.3f);
mTransformed.Clear();
mTransformed.Add(InterpolateCandleInRect(new CandleChartData.CandleValue(y1, high, low, y2, 0.1, 0.1), viewRect));
mTransformed.Add(InterpolateCandleInRect(new CandleChartData.CandleValue(y1, low, high, y2, 0.5, 0.2), viewRect));
edit = true;
index++;
}
CategoryObject categoryObj = new CategoryObject(this);
CanvasCandle up = CreateDataObject(data, mask);
CanvasCandle down = CreateDataObject(data, mask);
FillCurrentSeries(true, refrenceIndex);
up.Generate(this, viewRect, mCurrentSeries, data.UpCandle);
FillCurrentSeries(false, refrenceIndex);
down.Generate(this, viewRect, mCurrentSeries, data.DownCandle);
string catName = data.Name;
categoryObj.mUp = up;
categoryObj.mDown = down;
categoryObj.HookEvents();
GenerateItemLabels(false, categoryObj, data, viewRect, refrenceIndex, edit);
categoryObj.Hover += (idx, t, d, pos) => { Category_Hover(catName, idx, t, d, pos); };
categoryObj.Click += (idx, t, d, pos) => { Category_Click(catName, idx, t, d, pos); };
categoryObj.Leave += () => { Category_Leave(catName); };
mCategoryObjects[catName] = categoryObj;
}
}
void Category_Hover(string category, int index, int type, object data, Vector2 position)
{
CandleChartData.CandleValue candle = Data.GetCandle(category, index);
Dictionary<int, BillboardText> catgoryTexts;
BillboardText b;
if (mTexts.TryGetValue(category, out catgoryTexts))
{
if (catgoryTexts.TryGetValue(index, out b))
SelectActiveText(b);
}
Rect selection = new Rect();
if (data != null && data is Rect)
selection = (Rect)data;
OnItemHoverted(new CandleEventArgs(index, type, selection, position, candle, category));
}
/// <summary>
/// handles click of the category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
/// <param name="type"></param>
/// <param name="data"></param>
/// <param name="position"></param>
void Category_Click(string category, int index, int type, object data, Vector2 position)
{
CandleChartData.CandleValue candle = Data.GetCandle(category, index);
Dictionary<int, BillboardText> catgoryTexts;
BillboardText b;
if (mTexts.TryGetValue(category, out catgoryTexts))
{
if (catgoryTexts.TryGetValue(index, out b))
SelectActiveText(b);
}
Rect selection = new Rect();
if (data != null && data is Rect)
selection = (Rect)data;
OnItemSelected(new CandleEventArgs(index, type, selection, position, candle, category));
}
void Category_Leave(string cat)
{
TriggerActiveTextsOut();
OnItemLeave(new CandleEventArgs(0, 0, new Rect(), new Vector3(), new CandleChartData.CandleValue(), cat),"none");
}
protected override void OnItemHoverted(object userData)
{
base.OnItemHoverted(userData);
var args = userData as CandleEventArgs;
mOccupiedCateogies.Add(args.Category);
}
protected override void OnItemSelected(object userData)
{
base.OnItemSelected(userData);
var args = userData as CandleEventArgs;
mOccupiedCateogies.Add(args.Category);
}
protected override void OnItemLeave(object userData,string type)
{
//base.OnItemLeave(userData);
CandleEventArgs args = userData as CandleEventArgs;
if (args == null)
return;
string category = args.Category;
mOccupiedCateogies.Remove(category);
mOccupiedCateogies.RemoveWhere(x => !Data.HasCategory(x));
if (mOccupiedCateogies.Count == 0)
{
if (NonHovered != null)
NonHovered.Invoke();
}
}
internal override void SetAsMixedSeries()
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 25a10981261111f4bbc2ed5f2cd476f7
timeCreated: 1501868716
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,506 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace ChartAndGraph
{
class CanvasCandleGraphic : EventHandlingGraphic
{
CandleChartData.CandleSettings mCandleSettings;
List<CandleChartData.CandleValue> mCandles = new List<CandleChartData.CandleValue>();
int mPart;
UIVertex[] mTmpVerts = new UIVertex[4];
Vector2 mMin, mMax;
protected override Vector2 Min
{
get
{
return mMin;
}
}
protected override Vector2 Max
{
get
{
return mMax;
}
}
protected Rect RectFromIndex(int index, int type, Rect Default)
{
if (index >= mCandles.Count)
return Default;
CandleChartData.CandleValue candle = mCandles[index];
float max = (float)candle.Max;
float min = (float)candle.Min;
float start = (float)candle.Start;
float end = (float)(candle.Start + candle.Duration);
float mid = (start + end) * 0.5f;
if (type == 0)
return ChartCommon.RectFromCenter(mid, (float)mCandleSettings.LineThickness, max, (float)candle.High);
if (type == 2)
return ChartCommon.RectFromCenter(mid, (float)mCandleSettings.LineThickness, (float)candle.Low, min);
return ChartCommon.RectFromCenter(mid, (float)(mCandleSettings.CandleThicknessMultiplier * candle.Duration), min, max);
}
protected override void SetUpHoverObject(ChartItemEffect hover, int index, int type, object selectionData)
{
Rect selectionRect = (Rect)selectionData;
selectionRect = RectFromIndex(index, type, selectionRect);
hover.ItemData = selectionRect;
SetupHoverObjectToRect(hover, index, type, selectionRect);
}
protected void PickLine(Vector3 mouse, out int pickedIndex, out int pickedType, out object selectionData)
{
pickedIndex = -1;
pickedType = -1;
selectionData = null;
for (int i = 0; i < mCandles.Count; i++)
{
CandleChartData.CandleValue candle = mCandles[i];
float max = (float)candle.Max;
float min = (float)candle.Min;
float start = (float)candle.Start;
float end = (float)(candle.Start + candle.Duration);
float mid = (start + end) * 0.5f;
Rect high = ChartCommon.RectFromCenter(mid, (float)mCandleSettings.LineThickness, max, (float)candle.High);
Rect low = ChartCommon.RectFromCenter(mid, (float)mCandleSettings.LineThickness, (float)candle.Low, min);
if (high.Contains(mouse))
{
selectionData = high;
pickedType = 0;
pickedIndex = i;
return;
}
if (low.Contains(mouse))
{
selectionData = low;
pickedType = 2;
pickedIndex = i;
return;
}
}
}
protected void PickBody(Vector3 mouse, out int pickedIndex, out int pickedType, out object selectionData)
{
pickedIndex = -1;
pickedType = -1;
selectionData = null;
for (int i = 0; i < mCandles.Count; i++)
{
CandleChartData.CandleValue candle = mCandles[i];
float max = (float)candle.Max;
float min = (float)candle.Min;
float start = (float)candle.Start;
float end = (float)(candle.Start + candle.Duration);
float mid = (start + end) * 0.5f;
Rect Body = ChartCommon.RectFromCenter(mid, (float)(mCandleSettings.CandleThicknessMultiplier * candle.Duration), min, max);
if (Body.Contains(mouse))
{
selectionData = Body;
pickedType = 1;
pickedIndex = i;
return;
}
}
}
protected override void Pick(Vector3 mouse, out int pickedIndex, out int pickedType, out object selectionData)
{
if (mPart == 0)
PickBody(mouse, out pickedIndex, out pickedType, out selectionData);
else
PickLine(mouse, out pickedIndex, out pickedType, out selectionData);
if (pickedIndex >= 0)
pickedIndex += refrenceIndex;
}
protected override float MouseInThreshold
{
get
{
return Sensitivity;
}
}
public void ClearCandles()
{
mCandles = null;
SetAllDirty();
Rebuild(CanvasUpdate.PreRender);
}
public void SetCandle(int part, IList<CandleChartData.CandleValue> candles, CandleChartData.CandleSettings settings)
{
mPart = part;
mCandles.Clear();
mCandles.AddRange(candles);
mCandleSettings = settings;
double minX = double.PositiveInfinity;
double minY = double.PositiveInfinity;
double maxX = double.NegativeInfinity;
double maxY = double.NegativeInfinity;
for (int i = 0; i < mCandles.Count; i++)
{
var candle = mCandles[i];
minY = Math.Min(candle.LowBound, minY);
maxY = Math.Max(candle.HighBound, maxY);
minX = Math.Min(minX, candle.Start);
maxX = Math.Max(maxX, candle.Start + candle.Duration);
}
mMin = new Vector2((float)minX, (float)minY);
mMax = new Vector2((float)maxX, (float)maxY);
SetAllDirty();
Rebuild(CanvasUpdate.PreRender);
SetUpAllHoverObjects();
}
IEnumerable<UIVertex> getOutline()
{
UIVertex v = new UIVertex();
if (mCandles == null)
yield break;
float outlineThickness = (float)mCandleSettings.OutlineThickness * 0.5f;
for (int i = 0; i < mCandles.Count; i++)
{
CandleChartData.CandleValue candle = mCandles[i];
float max = (float)Math.Max(candle.Open, candle.Close);
float min = (float)Math.Min(candle.Open, candle.Close);
float start = (float)candle.Start;
float end = (float)(candle.Start + candle.Duration);
float mid = (start + end) * 0.5f;
float thickness = (float)(mCandleSettings.CandleThicknessMultiplier * candle.Duration * 0.5);
//long and dirty part the defines all the verices of the candle outline
//outline of the body
v.position = new Vector3(mid - thickness - outlineThickness, max, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid - thickness + outlineThickness, max, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - thickness - outlineThickness, min, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid - thickness + outlineThickness, min, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the body
v.position = new Vector3(mid + thickness - outlineThickness, max, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + thickness + outlineThickness, max, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid + thickness - outlineThickness, min, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + thickness + outlineThickness, min, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the high line
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness - outlineThickness, (float)candle.High, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness + outlineThickness, (float)candle.High, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness - outlineThickness, max, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness + outlineThickness, max, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the high line
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness - outlineThickness, (float)candle.High, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness + outlineThickness, (float)candle.High, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness - outlineThickness, max, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness + outlineThickness, max, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the low line
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness - outlineThickness, min, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness + outlineThickness, min, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness - outlineThickness, (float)candle.Low, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness + outlineThickness, (float)candle.Low, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the low line
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness - outlineThickness, min, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness + outlineThickness, min, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness - outlineThickness, (float)candle.Low, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness + outlineThickness, (float)candle.Low, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the low line connection with body
v.position = new Vector3(mid - thickness - outlineThickness, min + outlineThickness, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, min + outlineThickness, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - thickness - outlineThickness, min - outlineThickness, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, min - outlineThickness, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the low line connection with body
v.position = new Vector3(mid + thickness + outlineThickness, min + outlineThickness, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, min + outlineThickness, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid + thickness + outlineThickness, min - outlineThickness, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, min - outlineThickness, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the high line connection with body
v.position = new Vector3(mid - thickness - outlineThickness, max - outlineThickness, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, max - outlineThickness, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - thickness - outlineThickness, max + outlineThickness, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, max + outlineThickness, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
//outline of the high line connection with body
v.position = new Vector3(mid + thickness + outlineThickness, max - outlineThickness, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, max - outlineThickness, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid + thickness + outlineThickness, max + outlineThickness, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, max + outlineThickness, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
}
}
IEnumerable<UIVertex> getCandle()
{
UIVertex v = new UIVertex();
if (mCandles == null)
yield break;
for (int i = 0; i < mCandles.Count; i++)
{
CandleChartData.CandleValue candle = mCandles[i];
float max = (float)Math.Max(candle.Open, candle.Close);
float min = (float)Math.Min(candle.Open, candle.Close);
float start = (float)candle.Start;
float end = (float)(candle.Start + candle.Duration);
float mid = (start + end) * 0.5f;
float thickness = (float)(mCandleSettings.CandleThicknessMultiplier * candle.Duration * 0.5);
v.position = new Vector3(mid - thickness, max, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + thickness, max, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - thickness, min, 0f);
v.uv0 = new Vector2(-0f, 1f);
yield return v;
v.position = new Vector3(mid + thickness, min, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
}
}
IEnumerable<UIVertex> getLine()
{
UIVertex v = new UIVertex();
if (mCandles == null)
yield break;
for (int i = 0; i < mCandles.Count; i++)
{
CandleChartData.CandleValue candle = mCandles[i];
float max = (float)Math.Max(candle.Open, candle.Close);
float min = (float)Math.Min(candle.Open, candle.Close);
float start = (float)candle.Start;
float end = (float)(candle.Start + candle.Duration);
float mid = (start + end) * 0.5f;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, (float)candle.High, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, (float)candle.High, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, max, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, max, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, min, 0f);
v.uv0 = new Vector2(0f, 0f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, min, 0f);
v.uv0 = new Vector2(1f, 0f);
yield return v;
v.position = new Vector3(mid - (float)mCandleSettings.LineThickness, (float)candle.Low, 0f);
v.uv0 = new Vector2(0f, 1f);
yield return v;
v.position = new Vector3(mid + (float)mCandleSettings.LineThickness, (float)candle.Low, 0f);
v.uv0 = new Vector2(1f, 1f);
yield return v;
}
}
IEnumerable<UIVertex> getVerices()
{
if (mCandles == null)
return new UIVertex[0];
if (mPart == 0)
return getCandle();
else if (mPart == 1)
return getLine();
return getOutline();
}
#if (!UNITY_5_2_0) && (!UNITY_5_2_1)
protected override void OnPopulateMesh(VertexHelper vh)
{
base.OnPopulateMesh(vh);
vh.Clear();
int vPos = 0;
foreach (UIVertex v in getVerices())
{
mTmpVerts[vPos++] = v;
if (vPos == 4)
{
UIVertex tmp = mTmpVerts[2];
mTmpVerts[2] = mTmpVerts[3];
mTmpVerts[3] = tmp;
vPos = 0;
vh.AddUIVertexQuad(mTmpVerts);
}
}
}
#endif
#pragma warning disable 0672
#if !UNITY_2017_1_OR_NEWER
protected override void OnPopulateMesh(Mesh m)
{
WorldSpaceChartMesh mesh = new WorldSpaceChartMesh(1);
int vPos = 0;
foreach (UIVertex v in getVerices())
{
mTmpVerts[vPos++] = v;
if (vPos == 4)
{
vPos = 0;
mesh.AddQuad(mTmpVerts[0], mTmpVerts[1], mTmpVerts[2], mTmpVerts[3]);
}
}
mesh.ApplyToMesh(m);
}
#endif
#pragma warning restore 0672
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 05af876f1131be94d999a98f574aa820
timeCreated: 1491155958
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
interface ICandleCreator
{
void Generate(CandleChart parent, Rect viewRect, IList<CandleChartData.CandleValue> value, CandleChartData.CandleSettings settings);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dc37318de0ced4249a4f86d43c9799cc
timeCreated: 1491395378
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
interface IInternalCandleData
{
/// <summary>
///
/// </summary>
/// <param name="axis">0 for horizontal 1 for vertical</param>
/// <returns></returns>
double GetMinValue(int axis, bool dataValue);
double GetMaxValue(int axis, bool dataValue);
void OnBeforeSerialize();
void OnAfterDeserialize();
event EventHandler InternalDataChanged;
event EventHandler InternalViewPortionChanged;
event Action<int,string> InternalRealTimeDataChanged;
int TotalCategories { get; }
IEnumerable<CandleChartData.CategoryData> Categories { get; }
}
}

Some files were not shown because too many files have changed in this diff Show More