Skip to content

Instantly share code, notes, and snippets.

View dyguests's full-sized avatar
:octocat:
٩(˃̶͈̀௰˂̶͈́)و

fanhl dyguests

:octocat:
٩(˃̶͈̀௰˂̶͈́)و
  • ChengDu.China
View GitHub Profile
@dyguests
dyguests / DOTweenEx.cs
Created September 6, 2022 15:12
DOTween Extra Tools.
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
namespace Tools
{
public static class DOTweenEx
{
public static TweenerCore<float, float, FloatOptions> DOAlpha(
@dyguests
dyguests / SizePerfectCanvas.cs
Last active June 20, 2023 02:59
SizePerfectCanvas. adapter size.
using UnityEngine;
using UnityEngine.UI;
namespace Script.Tools
{
[RequireComponent(typeof(CanvasScaler))]
[ExecuteAlways]
public class SizePerfectCanvas : MonoBehaviour
{
[SerializeField] private CanvasScaler canvasScaler;
@dyguests
dyguests / SizePerfectCamera.cs
Last active May 6, 2022 16:11
SizePerfectCamera. adapter size.
using UnityEngine;
namespace Tools
{
[ExecuteAlways]
public class SizePerfectCamera : MonoBehaviour
{
[SerializeField] private new Camera camera;
[Space] [Tooltip("摄像机的尺寸范围(最小值,最大值)")] [SerializeField]
@dyguests
dyguests / BinaryIndexedTree.kt
Created November 18, 2021 07:53
BinaryIndexedTree, 数状数组
class BinaryIndexedTree(private var nums: IntArray) {
var size: Int = nums.size
private val _bit = IntArray(size + 1)
init {
for (i in 0 until size) init(i, nums[i])
}
private fun init(index: Int, value: Int) {
var i = index + 1
@dyguests
dyguests / GroundHelper.cs
Last active February 9, 2022 14:15
GroundHelper, PhysicsObject, grounded checker.
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Utils
{
public class GroundHelper
{
private const float minMoveDistance = 0.001f;
private const float shellRadius = 0.01f;
@dyguests
dyguests / SceneStacker.cs
Last active October 7, 2022 02:38
Scene Manager
using System.Collections.Generic;
using UnityEngine.SceneManagement;
namespace Tools
{
public static class SceneStacker
{
private static readonly Stack<string> SceneStack = new();
private static bool sIsInitialization;
@dyguests
dyguests / Touchable.cs
Created July 31, 2021 15:33
Unity Button without Image.
// https://stackoverflow.com/questions/36888780/how-to-make-an-invisible-transparent-button-work
// file Touchable.cs
// Correctly backfills the missing Touchable concept in Unity.UI's OO chain.
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(Touchable))]
public class Touchable_Editor : Editor
@dyguests
dyguests / AnimationCurveEx.cs
Created June 6, 2021 02:50
AnimationCurve PlayEvaluate
using System;
using System.Collections;
using UnityEngine;
namespace Util
{
public static class AnimationCurveEx
{
public static IEnumerator PlayEvaluate(this AnimationCurve curve, float time, Action<float> action, params Tuple<float, Action>[] animationEvents)
{
@dyguests
dyguests / FillScreen.cs
Created March 28, 2021 09:39
fill screen.
using UnityEngine;
namespace Game
{
public class FillScreen : MonoBehaviour
{
public SpriteRenderer sr;
private void Awake()
{
@dyguests
dyguests / InputCtlr.cs
Created March 6, 2021 13:47
Mouse To World
using Common;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Game
{
public class InputCtlr : MonoBehaviour
{
private InputActions inputActions;