Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
٩(˃̶͈̀௰˂̶͈́)و

fanhl dyguests

:octocat:
٩(˃̶͈̀௰˂̶͈́)و
  • ChengDu.China
View GitHub Profile
@dyguests
dyguests / Inputer2DHelper.cs
Created Mar 5, 2020
Unity Inputer2DHelper
View Inputer2DHelper.cs
using System;
using UnityEngine;
namespace Lina.Scripts
{
public struct Inputer2DHelper
{
private Vector2 move;
private bool fire1;
@dyguests
dyguests / PhysicsObject.cs
Created Jan 30, 2020
Unity PhysicsObject
View PhysicsObject.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PhysicsObject : MonoBehaviour {
public float minGroundNormalY = .65f;
public float gravityModifier = 1f;
protected Vector2 targetVelocity;
View Draggable.cs
using UnityEngine;
namespace Game.Model
{
/// <summary>
/// 有可拖拽的
/// </summary>
public class Draggable : MonoBehaviour
{
private float startPosX;
@dyguests
dyguests / ImageViews.kt
Last active Mar 28, 2019
Parallax ImageView,WindowImageView,Helper
View ImageViews.kt
fun ImageView.setImageAsDrawable(
url: String,
@DrawableRes placeHolder: Int? = null
) {
Glide.with(this)
// .asBitmap()
.load(url)
.apply {
if (placeHolder != null) {
apply(RequestOptions().placeholder(placeHolder))
@dyguests
dyguests / DialogFragment.kt
Created Mar 28, 2019
Rounded Corners Dialog
View DialogFragment.kt
class XxxDialogFragment:DialogFragment(){
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater?.inflate(R.layout.dialog_share_vehicle, container, false)
dialog?.window?.apply {
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
requestFeature(Window.FEATURE_NO_TITLE)
}
return view
}
}
@dyguests
dyguests / ComponentUtil.cs
Created Dec 6, 2018
Unity ComponentUtils
View ComponentUtil.cs
using System;
using UnityEngine;
namespace Utils
{
public static class ComponentUtils
{
/// <summary>
/// 将一个Component复制到另一个GameObject中
///
View PixelCamera.cs
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class PixelCamera : MonoBehaviour {
public int referenceHeight = 180;
public int pixelsPerUnit = 32;
private int renderWidth;
private int renderHeight;
@dyguests
dyguests / DontDestroyOnLoad.cs
Created Nov 11, 2018
Keep in Scene changed
View DontDestroyOnLoad.cs
using System;
using UnityEngine;
public class App : MonoBehaviour
{
public static App instance;
[Header("配置")] public Config config;
void Awake()
@dyguests
dyguests / ClickableMovementMethod.kt
Created Nov 7, 2018
使 TextView 的 ClickSpan 可以响应,但是不影响 原TextView其它区域的点击处理,防止父控件无响应
View ClickableMovementMethod.kt
import android.text.Selection
import android.text.Spannable
import android.text.Spanned
import android.text.method.BaseMovementMethod
import android.text.style.ClickableSpan
import android.view.MotionEvent
import android.view.View
import android.widget.TextView
@dyguests
dyguests / FollowBehavior.cs
Created Nov 3, 2018
Unity Camera Smoothly and Fluidly Follow Behaviour
View FollowBehavior.cs
using UnityEngine;
using System.Collections;
public class Follow : MonoBehaviour {
public GameObject objectToFollow;
public float speed = 2.0f;
void Update () {
You can’t perform that action at this time.