This commit is contained in:
2024-10-16 00:03:41 +08:00
commit 897058435c
5033 changed files with 1009728 additions and 0 deletions

8
Assets/3rd/Editor.meta Normal file
View File

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

View File

@@ -0,0 +1,230 @@
using UnityEditor;
using UnityEditor.Compilation;
using System.Diagnostics;
using Debug = UnityEngine.Debug;
using UnityEngine;
using System.Reflection;
/// <summary>
/// ____DESC: 手动reload domain 工具
/// </summary>
public class ScriptCompileReloadTools
{
/* 说明
* 关于域重载 https://docs.unity.cn/cn/2021.3/Manual/DomainReloading.html
* EditorApplication.LockReloadAssemblies()和 EditorApplication.UnlockReloadAssemblies() 最好成对
* 如果不小心LockReloadAssemblies3次 但是只UnlockReloadAssemblies了一次 那么还是不会重载 必须也要但是只UnlockReloadAssemblies3次
*/
const string menuEnableManualReload = "Tools/Script/开启手动Reload Domain";
const string menuDisenableManualReload ="Tools/Script/关闭手动Reload Domain";
const string menuRealodDomain ="Tools/Script/Unlock Reload %t";
const string kManualReloadDomain = "ManualReloadDomain";
const string kFirstEnterUnity = "FirstEnterUnity"; //是否首次进入unity
const string kReloadDomainTimer = "ReloadDomainTimer";//计时
/**************************************************/
//编译时间
static Stopwatch compileSW = new Stopwatch();
//是否手动reload
static bool IsManualReload => PlayerPrefs.GetInt(kManualReloadDomain, -1) == 1;
//缓存数据 域重载之后数据会变成false 如果不是false 那么就要重载
static bool tempData = false;
//https://github.com/INeatFreak/unity-background-recompiler 来自这个库 反射获取是否锁住
static MethodInfo CanReloadAssembliesMethod;
static bool IsLocked
{
get
{
if (CanReloadAssembliesMethod == null)
{
// source: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/EditorApplication.bindings.cs#L154
CanReloadAssembliesMethod = typeof(EditorApplication).GetMethod("CanReloadAssemblies", BindingFlags.NonPublic | BindingFlags.Static);
if (CanReloadAssembliesMethod == null)
Debug.LogError("Can't find CanReloadAssemblies method. It might have been renamed or removed.");
}
return !(bool)CanReloadAssembliesMethod.Invoke(null, null);
}
}
/**************************************************/
[InitializeOnLoadMethod]
static void InitCompile()
{
//**************不需要这个可以注释********************************
CompilationPipeline.compilationStarted -= OnCompilationStarted;
CompilationPipeline.compilationStarted += OnCompilationStarted;
CompilationPipeline.compilationFinished -= OnCompilationFinished;
CompilationPipeline.compilationFinished += OnCompilationFinished;
//**************************************************************
//域重载事件监听
AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload;
AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
AssemblyReloadEvents.afterAssemblyReload -= OnAfterAssemblyReload;
AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload;
EditorApplication.playModeStateChanged -= EditorApplication_playModeStateChanged;
EditorApplication.playModeStateChanged += EditorApplication_playModeStateChanged;
// 首次启动的时候 并不会马上设置
//if (PlayerPrefs.HasKey(kManualReloadDomain))
//{
// Menu.SetChecked(menuEnableManualReload, IsManualReload ? true : false);
// Menu.SetChecked(menuDisenableManualReload, IsManualReload ? false : true);
//}
FirstCheckAsync();
}
//首次打开检测
async static void FirstCheckAsync()
{
await System.Threading.Tasks.Task.Delay(100);
//判断是否首次打开
//https://docs.unity.cn/cn/2021.3/ScriptReference/SessionState.html
if (SessionState.GetBool(kFirstEnterUnity, true))
{
SessionState.SetBool(kFirstEnterUnity, false);
Menu.SetChecked(menuEnableManualReload, IsManualReload ? true : false);
Menu.SetChecked(menuDisenableManualReload, IsManualReload ? false : true);
if (IsManualReload)
{
UnlockReloadDomain();
LockRealodDomain();
}
Debug.Log($"<color=lime>当前ReloadDomain状态,是否手动: {IsManualReload}</color>");
}
}
//运行模式改变
private static void EditorApplication_playModeStateChanged(PlayModeStateChange state)
{
switch (state)
{
case PlayModeStateChange.EnteredEditMode:
break;
case PlayModeStateChange.ExitingEditMode:
if (tempData)
{
UnlockReloadDomain();
EditorUtility.RequestScriptReload();
}
break;
case PlayModeStateChange.EnteredPlayMode:
tempData = true;
break;
case PlayModeStateChange.ExitingPlayMode:
break;
}
}
//当开始编译脚本
private static void OnCompilationStarted(object obj)
{
if (IsManualReload)
{
compileSW.Start();
Debug.Log("<color=yellow>Begin Compile</color>");
}
}
//结束编译
private static void OnCompilationFinished(object obj)
{
if (IsManualReload)
{
compileSW.Stop();
Debug.Log($"<color=yellow>End Compile 耗时:{compileSW.ElapsedMilliseconds} ms</color>");
compileSW.Reset();
}
}
//开始reload domain
private static void OnBeforeAssemblyReload()
{
if (IsManualReload)
{
Debug.Log("<color=yellow>Begin Reload Domain ......</color>");
//记录时间
SessionState.SetInt(kReloadDomainTimer, (int)(EditorApplication.timeSinceStartup * 1000));
}
}
//结束reload domain
private static void OnAfterAssemblyReload()
{
if (IsManualReload)
{
var timeMS = (int)(EditorApplication.timeSinceStartup * 1000) - SessionState.GetInt(kReloadDomainTimer, 0);
Debug.Log($"<color=yellow>End Reload Domain 耗时:{timeMS} ms</color>");
LockRealodDomain();
}
}
static void LockRealodDomain()
{
//如果没有锁住 锁住
if (!IsLocked)
{
EditorApplication.LockReloadAssemblies();
}
}
static void UnlockReloadDomain()
{
//如果锁住了 打开
if (IsLocked)
{
EditorApplication.UnlockReloadAssemblies();
}
}
[MenuItem(menuEnableManualReload)]
static void EnableManualReloadDomain()
{
Debug.Log("<color=cyan>开启手动 Reload Domain</color>");
Menu.SetChecked(menuEnableManualReload, true);
Menu.SetChecked(menuDisenableManualReload, false);
PlayerPrefs.SetInt(kManualReloadDomain, 1);
//编辑器设置 projectsetting->editor->enterPlayModeSetting
EditorSettings.enterPlayModeOptionsEnabled = true;
EditorSettings.enterPlayModeOptions = EnterPlayModeOptions.DisableDomainReload;
LockRealodDomain();
}
[MenuItem(menuDisenableManualReload)]
static void DisenableManualReloadDomain()
{
Debug.Log("<color=cyan>关闭手动 Reload Domain</color>");
Menu.SetChecked(menuEnableManualReload, false);
Menu.SetChecked(menuDisenableManualReload, true);
PlayerPrefs.SetInt(kManualReloadDomain, 0);
UnlockReloadDomain();
EditorSettings.enterPlayModeOptionsEnabled = false;
}
//手动刷新
[MenuItem(menuRealodDomain)]
static void ManualReload()
{
if (IsManualReload)
{
UnlockReloadDomain();
EditorUtility.RequestScriptReload();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bdd8b851ba824ab989993e7390c0df5c
timeCreated: 1675183169

View File

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

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: 869a82e6f4db67049a3b7d6b73f951eb
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,31 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 30
// buildToolsVersion '30.0.2'
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 17
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26+'
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 77ba741b8b6dabd45aba959b0b64136b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 48f329a73a9b9634b800079d6fcb58f0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foldcc.agreement_library"
xmlns:tools="http://schemas.android.com/tools">
<application
android:usesCleartextTraffic="true"
>
<!-- android:networkSecurityConfig="@xml/network_security_config"-->
<!-- tools:replace="android:networkSecurityConfig"-->
<meta-data
android:name="USER_AGREEMENT"
android:value="https://foldcc.cn/service.htm" />
<meta-data
android:name="PRIVACY_AGREEMENT"
android:value="https://foldcc.cn/privacy.htm" />
<meta-data
android:name="START_ACTIVITY"
android:value="com.unity3d.player.UnityPlayerActivity" />
<!--<meta-data-->
<!--android:name="AGREEMENT_STYLE_TYPE"-->
<!--android:value="drak" />-->
<activity
android:name="com.foldcc.agreement_library.AgreementDialogActivity"
android:launchMode="singleTop"
android:exported="true"/>
<!-- android:theme="@style/TransLateTheme"-->
<activity
android:name="com.foldcc.agreement_library.WebViewActivity"
android:launchMode="singleTop"
android:theme="@style/TransLateTheme"
android:exported="true"
/>
</application>
</manifest>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a6e6a19be47d09047a356277f6cd67be
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,192 @@
package com.foldcc.agreement_library;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class AgreementDialogActivity extends Activity {
private TextView mTvContent, mTvTips;
private ImageView mTipsImage;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int layoutId = R.layout.activity_agreement_dialog;
// if (getMetaData("AGREEMENT_STYLE_TYPE").equals("drak")){
// layoutId = R.layout.activity_agreement_dialog_new;
// }
setContentView(layoutId);
mTvTips = findViewById(R.id.agreement_dialog_agreement_tips);
mTipsImage = findViewById(R.id.agreement_dialog_agreement_tips_img);
if (mTvTips != null) {
mTvTips.setHighlightColor(getResources().getColor(android.R.color.transparent));
mTvTips.setMovementMethod(LinkMovementMethod.getInstance());
mTvTips.setText(getAgreementTipsContent());
}
SharedPreferencesHelper.init(this, "mineF");
if (SharedPreferencesHelper.getInt("agreement", 0) != 1) {
mTvContent = findViewById(R.id.agreement_dialog_content);
initRichText();
} else {
openActivity();
finish();
}
}
private SpannableStringBuilder getAgreementTipsContent() {
String text1 = "我已同意并知晓";
final String text2 = getString(R.string.ServiceAgreementTips);
String text3 = getString(R.string.And);
final String text4 = getString(R.string.PrivacyPolicyTips);
String content = text1 + text2 + text3 + text4;
SpannableStringBuilder spannableString = new SpannableStringBuilder(content);
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(@NonNull View view) {
checkClick(view);
}
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(getResources().getColor(R.color.agreementContentAndTitleColor));
}
}, 0, text1.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.agreementBtnColor)), text1.length(), text1.length() + text2.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
spannableString.setSpan(new AgreementClick(true), text1.length(), text1.length() + text2.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.agreementBtnColor)), text1.length() + text2.length() + text3.length(), text1.length() + text2.length() + text3.length() + text4.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
spannableString.setSpan(new AgreementClick(false), text1.length() + text2.length() + text3.length(), text1.length() + text2.length() + text3.length() + text4.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
return spannableString;
}
public void onRightBtnClick(View view) {
if (!isCheck){
Toast.makeText(this,getResources().getString(R.string.PleaseAgreeAgreement),Toast.LENGTH_SHORT).show();
return;
}
SharedPreferencesHelper.applyInt("agreement", 1);
openActivity();
finishCurActivity();
}
private void openActivity() {
try {
Class activity = getClassLoader().loadClass(getMetaData("START_ACTIVITY"));
Intent intent = new Intent(this, activity);
startActivity(intent);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
private void finishCurActivity() {
finish();
// this.overridePendingTransition(R.anim.dialog_scal_out, 0);
}
public void onLeftBtnClick(View view) {
System.exit(0);
}
private boolean isCheck = false;
public void checkClick(View view) {
isCheck = !isCheck;
int imgId = R.drawable.ic_select_n;
if (isCheck) {
imgId = R.drawable.ic_select_s;
} else {
imgId = R.drawable.ic_select_n;
}
mTipsImage.setImageResource(imgId);
}
public static void open(Activity activity) {
activity.startActivity(new Intent(activity, AgreementDialogActivity.class));
// activity.overridePendingTransition(R.anim.dialog_scal_in, R.anim.dialog_scal_out);
}
/**
* 初始化富文本
*/
private void initRichText() {
String text1 = "请务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包含但不限于:\n为了向你提供游戏内容、数据统计等服务我们需要搜集你的设备信息(操作系统、soc性能等)、操作日志(每局游戏统计数据等)等个人信息。你可阅读";
final String text3 = getString(R.string.ServiceAgreementTips);
String text4 = getString(R.string.And);
final String text5 = getString(R.string.PrivacyPolicyTips);
String text6 = getString(R.string.ServiceAgreementAndPrivacyPolicyConten02);
String content = text1 + text3 + text4 + text5 + text6;
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(content);
stringBuilder.setSpan(new AgreementClick(true), text1.length(), (text1 + text3).length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
stringBuilder.setSpan(new AgreementClick(false), (text1 + text3 + text4).length(), (text1 + text3 + text4 + text5).length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
if (mTvContent != null) {
mTvContent.setHighlightColor(getResources().getColor(android.R.color.transparent));
mTvContent.setMovementMethod(LinkMovementMethod.getInstance());
mTvContent.setText(stringBuilder);
}
}
private class AgreementClick extends ClickableSpan {
boolean isUserAgreement = true;
public AgreementClick(boolean isUserAgreement) {
this.isUserAgreement = isUserAgreement;
}
@Override
public void onClick(@NonNull View widget) {
//用户协议点击
String title = getString(R.string.ServiceAgreementTips);
String urlTag = getMetaData("USER_AGREEMENT");
if (!isUserAgreement) {
title = getString(R.string.PrivacyPolicyTips);
urlTag = getMetaData("PRIVACY_AGREEMENT");
}
WebViewActivity.open(AgreementDialogActivity.this, title, urlTag);
}
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(getResources().getColor(R.color.agreementBtnColor));
}
}
private String getMetaData(String metaName) {
ApplicationInfo appInfo = null;
String data = null;
try {
appInfo = AgreementDialogActivity.this.getPackageManager()
.getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
data = appInfo.metaData.getString(metaName);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return data;
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d88d0e512c96a4d47b04800e55fc38c7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
package com.foldcc.agreement_library;
import android.app.Activity;
import com.foldcc.agreement_library.AgreementDialogActivity;
import com.foldcc.agreement_library.SharedPreferencesHelper;
public class AgreementTools {
public void init(Activity unityActivity) {
AgreementDialogActivity.open(unityActivity);
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b9c1b497f45b6cc43ab0e736abaac2f6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,244 @@
package com.foldcc.agreement_library;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import java.util.Set;
public class SharedPreferencesHelper {
private static final String TAG = SharedPreferencesHelper.class.getSimpleName();
private static SharedPreferences mSharedPreferences = null;
/**
* 初始化
*
* @param applicationContext
* @param spName
*/
public static void init(Context applicationContext, String spName) {
if (TextUtils.isEmpty(spName)) {
throw new NullPointerException("When SharedPreferencesHelper init, SharedPreferences name is null!");
}
if (applicationContext == null) {
throw new NullPointerException("When SharedPreferencesHelper init, applicationContext is null!");
}
mSharedPreferences = applicationContext.getSharedPreferences(spName, Context.MODE_PRIVATE);
}
/**
* 删除key
*
* @param key The name of the preference to remove.
*/
public static void removeKey(String key) {
if (mSharedPreferences != null) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.remove(key);
editor.apply();
} else {
Log.e(TAG, "mSharedPreferences is null");
}
}
public static void clear() {
if (mSharedPreferences != null) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.clear();
editor.apply();
} else {
Log.e(TAG, "mSharedPreferences is null");
}
}
public static void applyInt(String key, int value) {
applyKeyValue(key, value);
}
public static void applyLong(String key, long value) {
applyKeyValue(key, value);
}
public static void applyFloat(String key, float value) {
applyKeyValue(key, value);
}
public static void applyBoolean(String key, boolean value) {
applyKeyValue(key, value);
}
public static void applyString(String key, String value) {
if (null == value) {//防止传入null时无法判断存储类型
applyKeyValue(key, "");
return;
}
applyKeyValue(key, value);
}
public static void applyStringSet(String key, Set<String> defValue) {
if (mSharedPreferences != null && null == defValue) {//防止传入null时无法判断存储类型
mSharedPreferences.edit().putStringSet(key, null).apply();
}
commitKeyValue(key, defValue);
}
public static boolean commitInt(String key, int value) {
return commitKeyValue(key, value);
}
public static boolean commitLong(String key, long value) {
return commitKeyValue(key, value);
}
public static boolean commitFloat(String key, float value) {
return commitKeyValue(key, value);
}
public static boolean commitBoolean(String key, boolean value) {
return commitKeyValue(key, value);
}
public static boolean commitString(String key, String value) {
if (null == value) {//防止传入null时无法判断存储类型
return commitKeyValue(key, "");
}
return commitKeyValue(key, value);
}
public static boolean commitStringSet(String key, Set<String> defValue) {
if (mSharedPreferences != null && null == defValue) {//防止传入null时无法判断存储类型
return mSharedPreferences.edit().putStringSet(key, null).commit();
}
return commitKeyValue(key, defValue);
}
public static int getInt(String key, int defValue) {
return (int) getValue(key, defValue);
}
public static long getLong(String key, long defValue) {
return (long) getValue(key, defValue);
}
public static float getFloat(String key, float defValue) {
return (float) getValue(key, defValue);
}
public static boolean getBoolean(String key, boolean defValue) {
return (boolean) getValue(key, defValue);
}
public static String getString(String key, String defValue) {
if (null == defValue) {//防止传入null时无法判断存储类型
return (String) getValue(key, "");
}
return (String) getValue(key, defValue);
}
public static Set<String> getStringSet(String key, Set<String> defValue) {
if (mSharedPreferences != null && null == defValue) {//防止传入null时无法判断存储类型
return mSharedPreferences.getStringSet(key, null);
}
return (Set<String>) getValue(key, defValue);
}
/**
* 异步提交保存
* 注不提供该方法给外部是因为传入的是Object类型表意不够明确使用易误导。
*
* @param key
* @param value
* @return
*/
private static void applyKeyValue(String key, Object value) {
if (mSharedPreferences == null) {
Log.e(TAG, "mSharedPreferences is null");
return;
}
SharedPreferences.Editor editor = setEditor(key, value);
editor.apply();
}
/**
* 立即提交保存,立即生效,立即返回保存到磁盘的成功与否
* 注不提供该方法给外部是因为传入的是Object类型表意不够明确使用易误导。
*
* @param key
* @param value
* @return
*/
private static boolean commitKeyValue(String key, Object value) {
if (mSharedPreferences == null) {
Log.e(TAG, "mSharedPreferences is null");
return false;
}
SharedPreferences.Editor editor = setEditor(key, value);
return editor.commit();
}
/**
* 统一保存处理
*
* @param key
* @param value
* @return
*/
private static SharedPreferences.Editor setEditor(String key, Object value) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
if (value instanceof String) {
editor.putString(key, (String) value);
} else if (value instanceof Integer) {
editor.putInt(key, (Integer) value);
} else if (value instanceof Long) {
editor.putLong(key, (Long) value);
} else if (value instanceof Float) {
editor.putFloat(key, (Float) value);
} else if (value instanceof Boolean) {
editor.putBoolean(key, (Boolean) value);
} else if (value instanceof Set) {
editor.putStringSet(key, (Set<String>) value);
}
return editor;
}
/**
* 统一获取处理
*
* @param key
* @param defValue
* @return
*/
private static Object getValue(String key, Object defValue) {
if (mSharedPreferences == null) {
Log.e(TAG, "mSharedPreferences is null");
return defValue;
}
if (defValue instanceof String) {
return mSharedPreferences.getString(key, (String) defValue);
} else if (defValue instanceof Integer) {
return mSharedPreferences.getInt(key, (Integer) defValue);
} else if (defValue instanceof Long) {
return mSharedPreferences.getLong(key, (Long) defValue);
} else if (defValue instanceof Float) {
return mSharedPreferences.getFloat(key, (Float) defValue);
} else if (defValue instanceof Boolean) {
return mSharedPreferences.getBoolean(key, (Boolean) defValue);
} else if (defValue instanceof Set) {
return mSharedPreferences.getStringSet(key, (Set<String>) defValue);
}
return defValue;
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1f57b3cd65cd65042ad84965c4bd0c32
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,145 @@
package com.foldcc.agreement_library;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
public class WebViewActivity extends Activity {
private TextView mTitleTv;
private WebView mWebView;
private ProgressBar mProgressBar;
private String url;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view);
mTitleTv = findViewById(R.id.web_view_title);
mWebView = findViewById(R.id.web_view);
mProgressBar = findViewById(R.id.web_view_progress_bar);
url = getIntent().getStringExtra("url");
String title = getIntent().getStringExtra("title");
initWebView();
if (title != null && !title.equals("")) {
if (mTitleTv != null) {
mTitleTv.setText(title);
}
if (mTitleTv != null) {
mTitleTv.setVisibility(View.VISIBLE);
}
} else {
if (mTitleTv != null) {
mTitleTv.setVisibility(View.GONE);
}
}
}
public void onCancel(View view) {
finish();
}
public static void open(Activity activity, String title, String agremmentUrl) {
Intent intent = new Intent(activity, WebViewActivity.class);
intent.putExtra("title", title);
intent.putExtra("url", agremmentUrl);
activity.startActivity(intent);
}
@SuppressLint("JavascriptInterface")
private void initWebView() {
if (mWebView != null) {
mWebView.loadUrl(url);
mWebView.addJavascriptInterface(this, "android");
mWebView.setWebChromeClient(webChromeClient);
mWebView.setWebViewClient(webViewClient);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(false);
}
}
private WebViewClient webViewClient = new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
if (mProgressBar != null) {
mProgressBar.setVisibility(View.GONE);
}
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {//页面开始加载
if (mProgressBar != null) {
mProgressBar.setVisibility(View.VISIBLE);
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
};
private WebChromeClient webChromeClient = new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
if (title != null && !title.equals("")) {
if (mTitleTv != null) {
mTitleTv.setText(title);
}
if (mTitleTv != null) {
mTitleTv.setVisibility(View.VISIBLE);
}
} else {
if (mTitleTv != null) {
mTitleTv.setVisibility(View.GONE);
}
}
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
if (mProgressBar != null) {
mProgressBar.setProgress(newProgress);
}
}
};
@Override
protected void onDestroy() {
super.onDestroy();
if (mWebView != null) {
mWebView.destroy();
mWebView = null;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (mWebView != null) {
if (mWebView.canGoBack() && keyCode == KeyEvent.KEYCODE_BACK) {//点击返回按钮的时候判断有没有上一页
mWebView.goBack(); // goBack()表示返回webView的上一页面
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1a80d74d75150764b94e886b93472f25
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true" >
<scale
android:duration="250"
android:fromXScale="1.5"
android:fromYScale="1.5"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" >
</scale>
<alpha
android:duration="250"
android:fromAlpha="0"
android:interpolator="@android:anim/decelerate_interpolator"
android:toAlpha="1.0" />
</set>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ac8a773da0b584c41b7950b738cecd04
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:fillEnabled="true" >
<scale
android:duration="250"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.5"
android:toYScale="1.5" >
</scale>
<alpha
android:duration="250"
android:fromAlpha="1.0"
android:interpolator="@android:anim/decelerate_interpolator"
android:toAlpha="0.0" />
</set>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9667ed3482b5eb84fb77231e7c1e5fc2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="@color/agreementDialogForegroundColor"/>
</shape>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4e070340c769eb74e83cf1fca3f2cf83
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="@color/agreementDialogForegroundColorDark"/>
</shape>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b0ed29ff6dd8fe140b2847cb44d67dd0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/agreementSplitLine"/>
<corners android:radius="5dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 398bed2947fbd224d949bb24a936f90e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/agreementSplitLineDark"/>
<corners android:radius="5dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 113cf7ccd3b8d4b43b17fe4553773d7b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/agreementBtnColor"/>
<corners android:radius="5dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: dcffc5bbdac56bc4e91d641e2df0e392
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/agreementBtnColorDark"/>
<corners android:radius="5dp"/>
</shape>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e453474d908281549b9dd8986b4ac3e1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3c879f4582a75174396444543da2cbbd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bef4890d832214d4a89f8b41c3842078
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<color android:color="@android:color/transparent" />
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/agreementBtnColor" />
</shape>
</clip>
</item>
</layer-list>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fd870269e9ff76649a6bd63dc2677db9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/agreementDialogBgColor"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="50dp"
android:background="@drawable/agreement_dialog_bg"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ServiceAgreementAndPrivacyPolicy"
android:textColor="@color/agreementContentAndTitleColor"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@color/agreementDialogContentBgColor"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/agreement_dialog_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/agreementContentAndTitleColor"
android:textSize="12sp" />
<LinearLayout
android:onClick="checkClick"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/agreement_dialog_agreement_tips_img"
android:layout_marginTop="2dp"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/ic_select_n" />
<TextView
android:textStyle="bold"
android:layout_marginStart="5dp"
android:id="@+id/agreement_dialog_agreement_tips"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/agreementContentAndTitleColor"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1"
android:background="@drawable/agreement_dialog_left_btn_bg"
android:onClick="onLeftBtnClick"
android:text="@string/NotUsedTemporarily"
android:textColor="@color/agreementBtnTextColor"
android:textSize="12sp" />
<View
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.5" />
<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1"
android:background="@drawable/agreement_dialog_right_btn_bg"
android:onClick="onRightBtnClick"
android:text="@string/Agree"
android:textColor="@color/agreementBtnTextColor"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0110f5119cff25246af961ab45c7355f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/agreementDialogBgColor"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="50dp"
android:background="@drawable/agreement_dialog_bg_drak"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="15dp"
android:paddingRight="10dp"
android:paddingBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ServiceAgreementAndPrivacyPolicy"
android:textColor="@color/agreementContentAndTitleColorDark"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@color/agreementDialogContentBgColorDark"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/agreement_dialog_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/agreementContentAndTitleColorDark"
android:textSize="12sp" />
<LinearLayout
android:onClick="checkClick"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/agreement_dialog_agreement_tips_img"
android:layout_marginTop="2dp"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/ic_select_n" />
<TextView
android:textStyle="bold"
android:layout_marginStart="5dp"
android:id="@+id/agreement_dialog_agreement_tips"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/agreementContentAndTitleColorDark"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1"
android:background="@drawable/agreement_dialog_left_btn_bg_drak"
android:onClick="onLeftBtnClick"
android:text="@string/NotUsedTemporarily"
android:textColor="@color/agreementBtnTextColorDark"
android:textSize="12sp" />
<View
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.5" />
<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1"
android:background="@drawable/agreement_dialog_right_btn_bg_drak"
android:onClick="onRightBtnClick"
android:text="@string/Agree"
android:textColor="@color/agreementBtnTextColorDark"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 69bedcd1f6b1e634d8f347c16ad56c09
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/webViewBgColor"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="49dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:onClick="onCancel"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/Cancel"
android:textColor="@color/agreementBtnColor"
android:textSize="17sp" />
<TextView
android:visibility="gone"
android:id="@+id/web_view_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/agreementContentAndTitleColor"
android:textSize="17sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:alpha="0.2"
android:background="@color/agreementSplitLine" />
<ProgressBar
android:id="@+id/web_view_progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="2dp"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/web_progress_drawable"
android:visibility="gone" />
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></WebView>
</LinearLayout>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 80939f89013771f48978da94d53d90bd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--标题和内容颜色-->
<color name="agreementContentAndTitleColor">#1D1D1D</color>
<!--隐私协议弹窗内容背景-->
<color name="agreementDialogContentBgColor">#FFFFFF</color>
<!--所以可以点击的颜色-->
<color name="agreementBtnColor">#F78B28</color>
<color name="agreementClickTextColor">#F78B28</color>
<!--隐私协议内容标题栏分割线颜色-->
<color name="agreementSplitLine">#9f9f9f</color>
<color name="agreementDialogBgColor">#2F2F2F</color>
<!--弹窗前景色-->
<color name="agreementDialogForegroundColor">#ffffffff</color>
<color name="agreementBtnTextColor">#ffffff</color>
<!--隐私协议内容背景-->
<color name="webViewBgColor">#ffffff</color>
<!--drak-->
<!--标题和内容颜色-->
<color name="agreementContentAndTitleColorDark">#E6E6E6</color>
<!--隐私协议弹窗内容背景-->
<color name="agreementDialogContentBgColorDark">#2E2E2E</color>
<!--所以可以点击的颜色-->
<color name="agreementClickTextColorDark">#F78B28</color>
<color name="agreementBtnColorDark">#2E2E2E</color>
<!--隐私协议内容标题栏分割线颜色-->
<color name="agreementSplitLineDark">#504F4F</color>
<color name="agreementDialogBgColorDark">#2F2F2F</color>
<!--弹窗前景色-->
<color name="agreementDialogForegroundColorDark">#494646</color>
<color name="agreementBtnTextColorDark">#DCDCDC</color>
<!--隐私协议内容背景-->
<color name="webViewBgColorDark">#FFFFFF</color>
</resources>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4cf8b77a456ebd64784999f5c453e656
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 038bfd2a647a4244f954d63d9c707d29
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
<resources>
<string name="ServiceAgreementAndPrivacyPolicy">服务协议和隐私政策</string>
<string name="NotUsedTemporarily">暂不使用</string>
<string name="Agree">同意</string>
<string name="ServiceAgreementTips">《服务协议》</string>
<string name="And"></string>
<string name="PrivacyPolicyTips">《隐私政策》</string>
<string name="ServiceAgreementAndPrivacyPolicyConten02">了解详细信息。如你同意,请点击“同意”开始接受我们的服务。</string>
<string name="Cancel">取消</string>
<string name="PleaseAgreeAgreement">请阅读并勾选服务协议和隐私政策</string>
</resources>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c0f3d06a9024aab44a8f4f0b90cc39e0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@android:color/black</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="colorAccent">@android:color/black</item>
</style>
<style name="TransLateTheme" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3e2081ec13095fd44bce1475e6c56c22
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,9 @@
<paths>
<!-- 这个下载路径也不可以修改必须为GDTDOWNLOAD -->
<external-cache-path
name="gdt_sdk_download_path1"
path="com_qq_e_download" />
<cache-path
name="gdt_sdk_download_path2"
path="com_qq_e_download" />
</paths>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0113966f726be48419ff1bbed44cbd32
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b9c0358af9a946e41859e3eb51912ecd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/3rd/UIEffect.meta Normal file
View File

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

12
Assets/3rd/UIEffect/.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: mob-sakai # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: mob_sakai # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: mob-sakai
---
NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment (please complete the following information):**
- Version [e.g. 4.0.0]
- Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
- Unity version: [e.g. 2018.2.8f1]
- Build options: [e.g. IL2CPP, .Net 4.x, LWRP]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: mob-sakai
---
NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,25 @@
---
name: Question
about: Ask a question about this project
title: ''
labels: question
assignees: mob-sakai
---
NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
**Describe what help do you need**
A description of the question.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment (please complete the following information):**
- Version [e.g. 4.0.0]
- Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
- Unity version: [e.g. 2018.2.8f1]
- Build options: [e.g. IL2CPP, .Net 4.x, LWRP]
**Additional context**
Add any other context or screenshots about the question here.

View File

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,100 @@
fileFormatVersion: 2
guid: 3e04c247fb2604af186173fce0bc62de
timeCreated: 1524468976
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
filterMode: 1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 2
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 10
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 256
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 256
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 256
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Android
maxTextureSize: 256
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: WebGL
maxTextureSize: 256
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,87 @@
Shader "Hidden/UI/Default (UIDissolve)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
[Header(Dissolve)]
_TransitionTex ("Transition Texture (A)", 2D) = "white" {}
_ParamTex ("Parameter Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#define DISSOLVE 1
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#pragma multi_compile __ ADD SUBTRACT FILL
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#define UI_DISSOLVE 1
#include "UIEffect.cginc"
#include "UIEffectSprite.cginc"
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
// Dissolve
color = ApplyTransitionEffect(color, IN.eParam);
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e1b48dc831eb147e9886c049033213bf
ShaderImporter:
externalObjects: {}
defaultTextures:
- _MainTex: {instanceID: 0}
- _TransitionTex: {instanceID: 0}
- _ParamTex: {instanceID: 0}
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,309 @@
#ifndef UI_EFFECT_INCLUDED
#define UI_EFFECT_INCLUDED
sampler2D _TransitionTex;
sampler2D _ParamTex;
#if GRAYSCALE | SEPIA | NEGA | PIXEL | MONO | CUTOFF | HUE
#define UI_TONE
#endif
#if ADD | SUBTRACT | FILL
#define UI_COLOR
#endif
#if FASTBLUR | MEDIUMBLUR | DETAILBLUR
#define UI_BLUR
#endif
// Unpack float to low-precision [0-1] fixed4.
fixed4 UnpackToVec4(float value)
{
const int PACKER_STEP = 64;
const int PRECISION = PACKER_STEP - 1;
fixed4 unpacked;
unpacked.x = (value % PACKER_STEP) / PRECISION;
value = floor(value / PACKER_STEP);
unpacked.y = (value % PACKER_STEP) / PRECISION;
value = floor(value / PACKER_STEP);
unpacked.z = (value % PACKER_STEP) / PRECISION;
value = floor(value / PACKER_STEP);
unpacked.w = (value % PACKER_STEP) / PRECISION;
return unpacked;
}
// Unpack float to low-precision [0-1] fixed3.
fixed3 UnpackToVec3(float value)
{
const int PACKER_STEP = 256;
const int PRECISION = PACKER_STEP - 1;
fixed3 unpacked;
unpacked.x = (value % (PACKER_STEP)) / (PACKER_STEP - 1);
value = floor(value / (PACKER_STEP));
unpacked.y = (value % PACKER_STEP) / (PACKER_STEP - 1);
value = floor(value / PACKER_STEP);
unpacked.z = (value % PACKER_STEP) / (PACKER_STEP - 1);
return unpacked;
}
// Unpack float to low-precision [0-1] half2.
half2 UnpackToVec2(float value)
{
const int PACKER_STEP = 4096;
const int PRECISION = PACKER_STEP - 1;
half2 unpacked;
unpacked.x = (value % (PACKER_STEP)) / (PACKER_STEP - 1);
value = floor(value / (PACKER_STEP));
unpacked.y = (value % PACKER_STEP) / (PACKER_STEP - 1);
return unpacked;
}
// Sample texture with blurring.
// * Fast: Sample texture with 3x3 kernel.
// * Medium: Sample texture with 5x5 kernel.
// * Detail: Sample texture with 7x7 kernel.
fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur, half4 mask)
{
#if FASTBLUR && EX
const int KERNEL_SIZE = 5;
const float KERNEL_[5] = { 0.2486, 0.7046, 1.0, 0.7046, 0.2486};
#elif MEDIUMBLUR && EX
const int KERNEL_SIZE = 9;
const float KERNEL_[9] = { 0.0438, 0.1719, 0.4566, 0.8204, 1.0, 0.8204, 0.4566, 0.1719, 0.0438};
#elif DETAILBLUR && EX
const int KERNEL_SIZE = 13;
const float KERNEL_[13] = { 0.0438, 0.1138, 0.2486, 0.4566, 0.7046, 0.9141, 1.0, 0.9141, 0.7046, 0.4566, 0.2486, 0.1138, 0.0438};
#elif FASTBLUR
const int KERNEL_SIZE = 3;
const float KERNEL_[3] = { 0.4566, 1.0, 0.4566};
#elif MEDIUMBLUR
const int KERNEL_SIZE = 5;
const float KERNEL_[5] = { 0.2486, 0.7046, 1.0, 0.7046, 0.2486};
#elif DETAILBLUR
const int KERNEL_SIZE = 7;
const float KERNEL_[7] = { 0.1719, 0.4566, 0.8204, 1.0, 0.8204, 0.4566, 0.1719};
#else
const int KERNEL_SIZE = 1;
const float KERNEL_[1] = { 1.0 };
#endif
float4 o = 0;
float sum = 0;
float2 shift = 0;
for(int x = 0; x < KERNEL_SIZE; x++)
{
shift.x = blur.x * (float(x) - KERNEL_SIZE/2);
for(int y = 0; y < KERNEL_SIZE; y++)
{
shift.y = blur.y * (float(y) - KERNEL_SIZE/2);
float2 uv = texcood + shift;
float weight = KERNEL_[x] * KERNEL_[y];
sum += weight;
#if EX
fixed masked = min(mask.x <= uv.x, uv.x <= mask.z) * min(mask.y <= uv.y, uv.y <= mask.w);
o += lerp(fixed4(0.5, 0.5, 0.5, 0), tex2D(tex, uv), masked) * weight;
#else
o += tex2D(tex, uv) * weight;
#endif
}
}
return o / sum;
}
// Sample texture with blurring.
// * Fast: Sample texture with 3x3 kernel.
// * Medium: Sample texture with 5x5 kernel.
// * Detail: Sample texture with 7x7 kernel.
fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur)
{
return Tex2DBlurring(tex, texcood, blur, half4(0,0,1,1));
}
// Sample texture with blurring.
// * Fast: Sample texture with 3x1 kernel.
// * Medium: Sample texture with 5x1 kernel.
// * Detail: Sample texture with 7x1 kernel.
fixed4 Tex2DBlurring1D (sampler2D tex, half2 uv, half2 blur)
{
#if FASTBLUR
const int KERNEL_SIZE = 3;
#elif MEDIUMBLUR
const int KERNEL_SIZE = 5;
#elif DETAILBLUR
const int KERNEL_SIZE = 7;
#else
const int KERNEL_SIZE = 1;
#endif
float4 o = 0;
float sum = 0;
float weight;
half2 texcood;
for(int i = -KERNEL_SIZE/2; i <= KERNEL_SIZE/2; i++)
{
texcood = uv;
texcood.x += blur.x * i;
texcood.y += blur.y * i;
weight = 1.0/(abs(i)+2);
o += tex2D(tex, texcood)*weight;
sum += weight;
}
return o / sum;
}
fixed3 shift_hue(fixed3 RGB, half VSU, half VSW)
{
fixed3 result;
result.x = (0.299 + 0.701*VSU + 0.168*VSW)*RGB.x
+ (0.587 - 0.587*VSU + 0.330*VSW)*RGB.y
+ (0.114 - 0.114*VSU - 0.497*VSW)*RGB.z;
result.y = (0.299 - 0.299*VSU - 0.328*VSW)*RGB.x
+ (0.587 + 0.413*VSU + 0.035*VSW)*RGB.y
+ (0.114 - 0.114*VSU + 0.292*VSW)*RGB.z;
result.z = (0.299 - 0.3*VSU + 1.25*VSW)*RGB.x
+ (0.587 - 0.588*VSU - 1.05*VSW)*RGB.y
+ (0.114 + 0.886*VSU - 0.203*VSW)*RGB.z;
return result;
}
// Apply tone effect.
fixed4 ApplyToneEffect(fixed4 color, fixed factor)
{
#ifdef GRAYSCALE
color.rgb = lerp(color.rgb, Luminance(color.rgb), factor);
#elif SEPIA
color.rgb = lerp(color.rgb, Luminance(color.rgb) * half3(1.07, 0.74, 0.43), factor);
#elif NEGA
color.rgb = lerp(color.rgb, 1 - color.rgb, factor);
#endif
return color;
}
// Apply color effect.
fixed4 ApplyColorEffect(half4 color, half4 factor)
{
#if FILL
color.rgb = lerp(color.rgb, factor.rgb, factor.a);
#elif ADD
color.rgb += factor.rgb * factor.a;
#elif SUBTRACT
color.rgb -= factor.rgb * factor.a;
#else
color.rgb = lerp(color.rgb, color.rgb * factor.rgb, factor.a);
#endif
#if CUTOFF
color.a = factor.a;
#endif
return color;
}
// Apply transition effect.
fixed4 ApplyTransitionEffect(half4 color, half3 transParam)
{
fixed4 param = tex2D(_ParamTex, float2(0.25, transParam.z));
float alpha = tex2D(_TransitionTex, transParam.xy).a;
#if REVERSE
fixed effectFactor = 1 - param.x;
#else
fixed effectFactor = param.x;
#endif
#if FADE
color.a *= saturate(alpha + (1 - effectFactor * 2));
#elif CUTOFF
color.a *= step(0.001, color.a * alpha - effectFactor);
#elif DISSOLVE
fixed width = param.y/4;
fixed softness = param.z;
fixed3 dissolveColor = tex2D(_ParamTex, float2(0.75, transParam.z)).rgb;
float factor = alpha - effectFactor * ( 1 + width ) + width;
fixed edgeLerp = step(factor, color.a) * saturate((width - factor)*16/ softness);
color = ApplyColorEffect(color, fixed4(dissolveColor, edgeLerp));
color.a *= saturate((factor)*32/ softness);
#endif
return color;
}
// Apply shiny effect.
half4 ApplyShinyEffect(half4 color, half2 shinyParam)
{
fixed nomalizedPos = shinyParam.x;
fixed4 param1 = tex2D(_ParamTex, float2(0.25, shinyParam.y));
fixed4 param2 = tex2D(_ParamTex, float2(0.75, shinyParam.y));
half location = param1.x * 2 - 0.5;
fixed width = param1.y;
fixed soft = param1.z;
fixed brightness = param1.w;
fixed gloss = param2.x;
half normalized = 1 - saturate(abs((nomalizedPos - location) / width));
half shinePower = smoothstep(0, soft, normalized);
half3 reflectColor = lerp(fixed3(1,1,1), color.rgb * 7, gloss);
color.rgb += color.a * (shinePower / 2) * brightness * reflectColor;
return color;
}
half3 RgbToHsv(half3 c) {
half4 K = half4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
half4 p = lerp(half4(c.bg, K.wz), half4(c.gb, K.xy), step(c.b, c.g));
half4 q = lerp(half4(p.xyw, c.r), half4(c.r, p.yzx), step(p.x, c.r));
half d = q.x - min(q.w, q.y);
half e = 1.0e-10;
return half3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
half3 HsvToRgb(half3 c) {
c = half3(c.x, clamp(c.yz, 0.0, 1.0));
half4 K = half4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
half3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, clamp(p.xyz - K.xxx, 0.0, 1.0), c.y);
}
// Apply Hsv effect.
half4 ApplyHsvEffect(half4 color, half param)
{
fixed4 param1 = tex2D(_ParamTex, float2(0.25, param));
fixed4 param2 = tex2D(_ParamTex, float2(0.75, param));
fixed3 targetHsv = param1.rgb;
fixed3 targetRange = param1.w;
fixed3 hsvShift = param2.xyz - 0.5;
half3 hsv = RgbToHsv(color.rgb);
half3 range = abs(hsv - targetHsv);
half diff = max(max(min(1-range.x, range.x), min(1-range.y, range.y)/10), min(1-range.z, range.z)/10);
fixed masked = step(diff, targetRange);
color.rgb = HsvToRgb(hsv + hsvShift * masked);
return color;
}
#endif // UI_EFFECT_INCLUDED

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7467061e9f5514f2c80e30817ee2458b
timeCreated: 1487915863
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,113 @@
Shader "Hidden/UI/Default (UIEffect)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
_ParamTex ("Parameter Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#if !defined(SHADER_API_D3D11_9X) && !defined(SHADER_API_D3D9)
#pragma target 2.0
#else
#pragma target 3.0
#endif
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#pragma multi_compile __ GRAYSCALE SEPIA NEGA PIXEL
#pragma multi_compile __ ADD SUBTRACT FILL
#pragma multi_compile __ FASTBLUR MEDIUMBLUR DETAILBLUR
#pragma multi_compile __ EX
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#define UI_EFFECT 1
#include "UIEffect.cginc"
#include "UIEffectSprite.cginc"
fixed4 frag(v2f IN) : SV_Target
{
fixed4 param = tex2D(_ParamTex, float2(0.25, IN.eParam));
fixed effectFactor = param.x;
fixed colorFactor = param.y;
fixed blurFactor = param.z;
#if PIXEL
half2 pixelSize = max(2, (1-effectFactor*0.95) * _MainTex_TexelSize.zw);
IN.texcoord = round(IN.texcoord * pixelSize) / pixelSize;
#endif
#if defined(UI_BLUR) && EX
half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, blurFactor * _MainTex_TexelSize.xy * 2, IN.uvMask) + _TextureSampleAdd);
#elif defined(UI_BLUR)
half4 color = (Tex2DBlurring(_MainTex, IN.texcoord, blurFactor * _MainTex_TexelSize.xy * 2) + _TextureSampleAdd);
#else
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
#endif
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#if UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
#if defined (UI_TONE)
color = ApplyToneEffect(color, effectFactor);
#endif
color = ApplyColorEffect(color, fixed4(IN.color.rgb, colorFactor));
color.a *= IN.color.a;
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b868e81d0156245e08c8646b4fb68d7a
timeCreated: 1482973535
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
#ifndef UI_EFFECT_SPRITE_INCLUDED
#define UI_EFFECT_SPRITE_INCLUDED
fixed4 _Color;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
sampler2D _MainTex;
float4 _MainTex_TexelSize;
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
#if EX
float2 uvMask : TEXCOORD1;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
#if UI_DISSOLVE || UI_TRANSITION
half3 eParam : TEXCOORD2;
#elif UI_SHINY
half2 eParam : TEXCOORD2;
#else
half eParam : TEXCOORD2;
#endif
#if EX
half4 uvMask : TEXCOORD3;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata_t IN)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = IN.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
#if UI_EFFECT
OUT.texcoord = UnpackToVec2(IN.texcoord.x) * 2 - 0.5;
#else
OUT.texcoord = UnpackToVec2(IN.texcoord.x);
#endif
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
OUT.color = IN.color * _Color;
#if UI_DISSOLVE || UI_TRANSITION
OUT.eParam = UnpackToVec3(IN.texcoord.y);
#elif UI_SHINY
OUT.eParam = UnpackToVec2(IN.texcoord.y);
#else
OUT.eParam = IN.texcoord.y;
#endif
#if EX
OUT.uvMask = half4(UnpackToVec2(IN.uvMask.x), UnpackToVec2(IN.uvMask.y));
#endif
return OUT;
}
#endif // UI_EFFECT_SPRITE_INCLUDED

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: dd60a36b172cf49e2b82258a68799ce3
timeCreated: 1487915863
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,79 @@
Shader "Hidden/UI/Default (UIHsvModifier)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
_ParamTex ("Parameter Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#define UI_HSV_MODIFIER 1
#include "UIEffect.cginc"
#include "UIEffectSprite.cginc"
fixed4 frag(v2f IN) : COLOR
{
half4 color = tex2D(_MainTex, IN.texcoord);// + _TextureSampleAdd) * IN.color;
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
color = ApplyHsvEffect(color, IN.eParam);
return (color + _TextureSampleAdd) * IN.color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7fc74090480c84f8b977cfcd55cdfe82
timeCreated: 1531882595
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,82 @@
Shader "Hidden/UI/Default (UIShiny)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
_ParamTex ("Parameter Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#define UI_SHINY 1
#include "UIEffect.cginc"
#include "UIEffectSprite.cginc"
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
color = ApplyShinyEffect(color, IN.eParam);
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 20ffe76c2439c403aabdd25bd94bf011
timeCreated: 1523859834
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,87 @@
Shader "Hidden/UI/Default (UITransition)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
[Header(Transition)]
_TransitionTex ("Transition Texture (A)", 2D) = "white" {}
_ParamTex ("Parameter Texture", 2D) = "white" {}
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#define REVERSE 1
#define ADD 1
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#pragma multi_compile __ FADE CUTOFF DISSOLVE
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#define UI_TRANSITION 1
#include "UIEffect.cginc"
#include "UIEffectSprite.cginc"
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
color = ApplyTransitionEffect(color, IN.eParam) * IN.color;
#if UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
return color;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 85ad24dd0759947ddb117625e108d49c
timeCreated: 1548078121
licenseType: Pro
ShaderImporter:
defaultTextures:
- _MainTex: {instanceID: 0}
- _NoiseTex: {fileID: 2800000, guid: 3e04c247fb2604af186173fce0bc62de, type: 3}
- _ParamTex: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 04feaefc7cdee4c13abcd553a1a6e3a9
folderAsset: yes
timeCreated: 1528368324
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIEffects
{
/// <summary>
/// Abstract effect base for UI.
/// </summary>
[DisallowMultipleComponent]
public abstract class BaseMaterialEffect : BaseMeshEffect, IParameterTexture, IMaterialModifier
{
protected static readonly Hash128 k_InvalidHash = new Hash128();
protected static readonly List<UIVertex> s_TempVerts = new List<UIVertex>();
private static readonly StringBuilder s_StringBuilder = new StringBuilder();
Hash128 _effectMaterialHash;
/// <summary>
/// Gets or sets the parameter index.
/// </summary>
public int parameterIndex { get; set; }
/// <summary>
/// Gets the parameter texture.
/// </summary>
public virtual ParameterTexture paramTex
{
get { return null; }
}
/// <summary>
/// Mark the vertices as dirty.
/// </summary>
public void SetMaterialDirty()
{
this.connector.SetMaterialDirty(this.graphic);
foreach (var effect in this.syncEffects)
{
effect.SetMaterialDirty();
}
}
public virtual Hash128 GetMaterialHash(Material baseMaterial)
{
return k_InvalidHash;
}
public Material GetModifiedMaterial(Material baseMaterial)
{
return GetModifiedMaterial(baseMaterial, this.graphic);
}
public virtual Material GetModifiedMaterial(Material baseMaterial, Graphic graphic)
{
if (!this.isActiveAndEnabled) return baseMaterial;
var oldHash = this._effectMaterialHash;
this._effectMaterialHash = GetMaterialHash(baseMaterial);
var modifiedMaterial = baseMaterial;
if (this._effectMaterialHash.isValid)
{
modifiedMaterial = MaterialCache.Register(baseMaterial, this._effectMaterialHash, ModifyMaterial, graphic);
}
MaterialCache.Unregister(oldHash);
return modifiedMaterial;
}
// protected bool isTMProMobile (Material material)
// {
// return material && material.shader && material.shader.name.StartsWith ("TextMeshPro/Mobile/", StringComparison.Ordinal);
// }
public virtual void ModifyMaterial(Material newMaterial, Graphic graphic)
{
if (this.isActiveAndEnabled && this.paramTex != null) this.paramTex.RegisterMaterial(newMaterial);
}
protected void SetShaderVariants(Material newMaterial, params object[] variants)
{
// Set shader keywords as variants
var keywords = variants.Where(x => 0 < (int) x)
.Select(x => x.ToString().ToUpper())
.Concat(newMaterial.shaderKeywords)
.Distinct()
.ToArray();
newMaterial.shaderKeywords = keywords;
// Add variant name
s_StringBuilder.Length = 0;
s_StringBuilder.Append(Path.GetFileName(newMaterial.shader.name));
foreach (var keyword in keywords)
{
s_StringBuilder.Append("-");
s_StringBuilder.Append(keyword);
}
newMaterial.name = s_StringBuilder.ToString();
}
#if UNITY_EDITOR
protected override void Reset()
{
if (!this.isActiveAndEnabled) return;
SetMaterialDirty();
SetVerticesDirty();
SetEffectParamsDirty();
}
protected override void OnValidate()
{
if (!this.isActiveAndEnabled) return;
SetVerticesDirty();
SetEffectParamsDirty();
}
#endif
/// <summary>
/// This function is called when the object becomes enabled and active.
/// </summary>
protected override void OnEnable()
{
base.OnEnable();
if (this.paramTex != null)
{
this.paramTex.Register(this);
}
SetMaterialDirty();
SetEffectParamsDirty();
// foreach (var mr in GetComponentsInChildren<UIEffectMaterialResolver> ())
// {
// mr.GetComponent<Graphic> ().SetMaterialDirty ();
// mr.GetComponent<Graphic> ().SetVerticesDirty ();
// }
}
/// <summary>
/// This function is called when the behaviour becomes disabled () or inactive.
/// </summary>
protected override void OnDisable()
{
base.OnDisable();
SetMaterialDirty();
if (this.paramTex != null)
{
this.paramTex.Unregister(this);
}
MaterialCache.Unregister(this._effectMaterialHash);
this._effectMaterialHash = k_InvalidHash;
}
// protected override void OnDidApplyAnimationProperties()
// {
// SetEffectParamsDirty();
// }
// protected override void OnTextChanged (UnityEngine.Object obj)
// {
// base.OnTextChanged (obj);
//
//
// foreach (var sm in GetComponentsInChildren<TMPro.TMP_SubMeshUI> ())
// {
// if(!sm.GetComponent<UIEffectMaterialResolver>())
// {
// var mr = sm.gameObject.AddComponent<UIEffectMaterialResolver> ();
//
// targetGraphic.SetAllDirty ();
// //targetGraphic.SetVerticesDirty ();
//
// //mr.GetComponent<Graphic> ().SetMaterialDirty ();
// //mr.GetComponent<Graphic> ().SetVerticesDirty ();
//
//
// }
// }
// }
}
}

View File

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

View File

@@ -0,0 +1,229 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Coffee.UIEffects
{
/// <summary>
/// Base class for effects that modify the generated Mesh.
/// It works well not only for standard Graphic components (Image, RawImage, Text, etc.) but also for TextMeshPro and TextMeshProUGUI.
/// </summary>
[RequireComponent(typeof(Graphic))]
[RequireComponent(typeof(RectTransform))]
[ExecuteInEditMode]
public abstract class BaseMeshEffect : UIBehaviour, IMeshModifier
{
RectTransform _rectTransform;
Graphic _graphic;
GraphicConnector _connector;
/// <summary>
/// The Graphic attached to this GameObject.
/// </summary>
protected GraphicConnector connector
{
get { return this._connector ?? (this._connector = GraphicConnector.FindConnector(this.graphic)); }
}
/// <summary>
/// The Graphic attached to this GameObject.
/// </summary>
public Graphic graphic
{
get { return this._graphic ? this._graphic : this._graphic = GetComponent<Graphic>(); }
}
/// <summary>
/// The RectTransform attached to this GameObject.
/// </summary>
protected RectTransform rectTransform
{
get { return this._rectTransform ? this._rectTransform : this._rectTransform = GetComponent<RectTransform>(); }
}
internal readonly List<UISyncEffect> syncEffects = new List<UISyncEffect>(0);
/// <summary>
/// Call used to modify mesh. (legacy)
/// </summary>
/// <param name="mesh">Mesh.</param>
public virtual void ModifyMesh(Mesh mesh)
{
}
/// <summary>
/// Call used to modify mesh.
/// </summary>
/// <param name="vh">VertexHelper.</param>
public virtual void ModifyMesh(VertexHelper vh)
{
ModifyMesh(vh, this.graphic);
}
public virtual void ModifyMesh(VertexHelper vh, Graphic graphic)
{
}
/// <summary>
/// Mark the vertices as dirty.
/// </summary>
protected virtual void SetVerticesDirty()
{
this.connector.SetVerticesDirty(this.graphic);
foreach (var effect in this.syncEffects)
{
effect.SetVerticesDirty();
}
// #if TMP_PRESENT
// if (textMeshPro)
// {
// foreach (var info in textMeshPro.textInfo.meshInfo)
// {
// var mesh = info.mesh;
// if (mesh)
// {
// mesh.Clear();
// mesh.vertices = info.vertices;
// mesh.uv = info.uvs0;
// mesh.uv2 = info.uvs2;
// mesh.colors32 = info.colors32;
// mesh.normals = info.normals;
// mesh.tangents = info.tangents;
// mesh.triangles = info.triangles;
// }
// }
//
// if (canvasRenderer)
// {
// canvasRenderer.SetMesh(textMeshPro.mesh);
//
// GetComponentsInChildren(false, s_SubMeshUIs);
// foreach (var sm in s_SubMeshUIs)
// {
// sm.canvasRenderer.SetMesh(sm.mesh);
// }
//
// s_SubMeshUIs.Clear();
// }
//
// textMeshPro.havePropertiesChanged = true;
// }
// else
// #endif
// if (graphic)
// {
// graphic.SetVerticesDirty();
// }
}
//################################
// Protected Members.
//################################
/// <summary>
/// Should the effect modify the mesh directly for TMPro?
/// </summary>
// protected virtual bool isLegacyMeshModifier
// {
// get { return false; }
// }
// protected virtual void Initialize()
// {
// if (_initialized) return;
//
// _initialized = true;
// _graphic = _graphic ? _graphic : GetComponent<Graphic>();
//
// _connector = GraphicConnector.FindConnector(_graphic);
//
// // _canvasRenderer = _canvasRenderer ?? GetComponent<CanvasRenderer> ();
// _rectTransform = _rectTransform ? _rectTransform : GetComponent<RectTransform>();
// // #if TMP_PRESENT
// // _textMeshPro = _textMeshPro ?? GetComponent<TMP_Text> ();
// // #endif
// }
/// <summary>
/// This function is called when the object becomes enabled and active.
/// </summary>
protected override void OnEnable()
{
this.connector.OnEnable(this.graphic);
SetVerticesDirty();
// SetVerticesDirty();
// #if TMP_PRESENT
// if (textMeshPro)
// {
// TMPro_EventManager.TEXT_CHANGED_EVENT.Add (OnTextChanged);
// }
// #endif
//
// #if UNITY_EDITOR && TMP_PRESENT
// if (graphic && textMeshPro)
// {
// GraphicRebuildTracker.TrackGraphic (graphic);
// }
// #endif
//
// #if UNITY_5_6_OR_NEWER
// if (graphic)
// {
// AdditionalCanvasShaderChannels channels = requiredChannels;
// var canvas = graphic.canvas;
// if (canvas && (canvas.additionalShaderChannels & channels) != channels)
// {
// Debug.LogWarningFormat (this, "Enable {1} of Canvas.additionalShaderChannels to use {0}.", GetType ().Name, channels);
// }
// }
// #endif
}
/// <summary>
/// This function is called when the behaviour becomes disabled () or inactive.
/// </summary>
protected override void OnDisable()
{
this.connector.OnDisable(this.graphic);
SetVerticesDirty();
}
/// <summary>
/// Mark the effect parameters as dirty.
/// </summary>
protected virtual void SetEffectParamsDirty()
{
if (!this.isActiveAndEnabled) return;
SetVerticesDirty();
}
/// <summary>
/// Callback for when properties have been changed by animation.
/// </summary>
protected override void OnDidApplyAnimationProperties()
{
if (!this.isActiveAndEnabled) return;
SetEffectParamsDirty();
}
#if UNITY_EDITOR
protected override void Reset()
{
if (!this.isActiveAndEnabled) return;
SetVerticesDirty();
}
/// <summary>
/// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only).
/// </summary>
protected override void OnValidate()
{
if (!this.isActiveAndEnabled) return;
SetEffectParamsDirty();
}
#endif
}
}

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