Skip to content

Instantly share code, notes, and snippets.

View Leopotam's full-sized avatar
🇷🇺

Leopotam Leopotam

🇷🇺
View GitHub Profile
using System.Collections.Generic;
using LeopotamGroup.Ecs.Ui.Components;
using UnityEngine;
namespace LeopotamGroup.Ecs.Ui.Tests {
public class TestUiClickEventSystem : EcsReactSystem {
[EcsWorld]
EcsWorld _world;
[EcsFilterInclude (typeof (EcsUiClickEvent))]
@Leopotam
Leopotam / TestDoubleQuesionMark.cs
Created October 22, 2017 01:43
TestDoubleQuesionMark
using UnityEngine;
sealed class TestDoubleQuesionMark : MonoBehaviour {
void OnEnable () {
Test<BoxCollider> ();
Test<SphereCollider> ();
Test<CharacterController> ();
Test<Rigidbody> ();
}
@Leopotam
Leopotam / Dockerfile
Created October 13, 2017 10:18
Dockerfile for latest alpine_node
FROM alpine:latest
ENV VERSION=v8.7.0
RUN apk add --no-cache curl gnupg python make gcc g++ linux-headers && \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
@Leopotam
Leopotam / TouchInput.cs
Created October 10, 2017 20:24
Mobile input
using Client.Zone.Units;
using Client.Zone.View;
using LeopotamGroup.Common;
using LeopotamGroup.Events;
using LeopotamGroup.SystemUi.Actions;
using UnityEngine;
namespace Client.Zone.Input {
sealed class TouchInput : MonoBehaviourService<TouchInput> {
const string EventFilterName = "OnScreenDrag";
@Leopotam
Leopotam / DesktopInput.cs
Created October 10, 2017 20:24
Desktop Input
using Client.Common;
using Client.Zone.Units;
using Client.Zone.View;
using LeopotamGroup.Common;
using LeopotamGroup.Events;
using UnityEngine;
namespace Client.Zone.Input {
sealed class DesktopInput : MonoBehaviourService<DesktopInput> {
bool _inputEnabled;
@Leopotam
Leopotam / ObjectPlacer.cs
Created September 29, 2017 11:58
Object placer
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEngine;
namespace Client.UnityEditors {
sealed class ObjectPlacer : MonoBehaviour {
[SerializeField]
GameObject _objectPrefab;
[SerializeField]
@Leopotam
Leopotam / JsonWithComments.ts
Created September 14, 2017 09:24
Json parsing with single- / multiline comments support.
const commentsRegexp = /\/(\/[^\n]*|\*(?:.|\n)*?\*\/)/g
/**
* Converts a JavaScript Object Notation (JSON) string into an object.
* @param text A valid JSON string.
* @param reviver A function that transforms the results. This function is called for each member of the object.
* If a member contains nested objects, the nested objects are transformed before the parent object is.
*/
export const parse = (text: string, reviver?: (key: any, value: any) => any): any => {
return JSON.parse(text.replace(commentsRegexp, ''), reviver)
}
@Leopotam
Leopotam / UnityIdents.cs
Created September 13, 2017 14:49
UnityIdents.cs
// Auto generated code, dont change it manually!
using UnityEngine;
namespace Client.Common {
public static partial class UnityIdents {
public const int SortingLayerDefault = 0;
public const string AxisCancel = "Cancel";
@Leopotam
Leopotam / Vector2.ts
Last active August 3, 2017 09:51
Vector2.ts
export default class Vector2 {
public static add(a: Vector2, b: Vector2): Vector2 {
return new Vector2(a.x + b.x, b.y + b.y);
}
public static mul(a: Vector2, b: Vector2): Vector2 {
return new Vector2(a.x * b.x, b.y * b.y);
}
public static dot(a: Vector2, b: Vector2): Vector2 {
Shader "Custom/UnlitTransparent" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_Amount ("Expand", Range(0, 10)) = 1
}
SubShader {
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True" "ForceNoShadowCasting" = "True" }
LOD 100