clocks
This commit is contained in:
@@ -109,8 +109,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: -1.5}
|
||||
m_SizeDelta: {x: -10, y: -7}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6470588784042037404
|
||||
CanvasRenderer:
|
||||
|
||||
@@ -539,6 +539,7 @@ MonoBehaviour:
|
||||
- {fileID: 21300000, guid: b77c21ad464eb5c45a4a1f8f0f276965, type: 3}
|
||||
- {fileID: 21300000, guid: 3aa2b0925144bb54193b25bf37dddf91, type: 3}
|
||||
- {fileID: 21300000, guid: 9ade58a4f17ab5a49bebda61d08ee88e, type: 3}
|
||||
- {fileID: 21300000, guid: b5f750949f494f64b8baf51ddce0cddc, type: 3}
|
||||
--- !u!4 &535412053
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CompuLogic.Workspace
|
||||
{
|
||||
public class ClockGate : Gate
|
||||
{
|
||||
#region Unity Properties
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private Anchor OutputAnchor {
|
||||
get
|
||||
{
|
||||
if (_outputAnchor == null)
|
||||
_outputAnchor = Anchors.FirstOrDefault(g => g.Name == "Q");
|
||||
return _outputAnchor;
|
||||
}
|
||||
}
|
||||
private Anchor _outputAnchor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity Methods
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Utils.RandomName("Input", gameObject);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void UpdateState()
|
||||
{
|
||||
if ((Sprite.Hovering || OutputAnchor.Hovering) && PointerManager.Instance.DoubleClick())
|
||||
{
|
||||
State = !State;
|
||||
}
|
||||
|
||||
if (State)
|
||||
{
|
||||
OutputAnchor.Activated = Mathf.Repeat(Time.time, CustomProperties[0]) >= CustomProperties[0] * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e96ac3a8b8e052746ab27ed052bf1f13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -20,9 +20,9 @@ namespace CompuLogic.Workspace
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_anchors == null)
|
||||
_anchors = GetComponentsInChildren<Anchor>().ToList();
|
||||
return _anchors;
|
||||
if(_anchors == null)
|
||||
_anchors = GetComponentsInChildren<Anchor>().ToList();
|
||||
return _anchors;
|
||||
}
|
||||
}
|
||||
public IEnumerable<Anchor> InputAnchors => Anchors.Where(a => a.IsInput);
|
||||
@@ -30,30 +30,31 @@ namespace CompuLogic.Workspace
|
||||
public BoxCollider2D Box {
|
||||
get
|
||||
{
|
||||
if (_box == null)
|
||||
_box = GetComponentInChildren<BoxCollider2D>();
|
||||
return _box;
|
||||
if (_box == null)
|
||||
_box = GetComponentInChildren<BoxCollider2D>();
|
||||
return _box;
|
||||
}
|
||||
}
|
||||
public GateSprite Sprite
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_sprite == null)
|
||||
_sprite = GetComponentInChildren<GateSprite>();
|
||||
return _sprite;
|
||||
if(_sprite == null)
|
||||
_sprite = GetComponentInChildren<GateSprite>();
|
||||
return _sprite;
|
||||
}
|
||||
}
|
||||
public GateDefinition Definition
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_definition == null)
|
||||
_definition = GateDefinition.Get(GateType, this);
|
||||
return _definition;
|
||||
if(_definition == null)
|
||||
_definition = GateDefinition.Get(GateType, this);
|
||||
return _definition;
|
||||
}
|
||||
}
|
||||
public string UIName { get; set; }
|
||||
public List<float> CustomProperties;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -89,7 +90,7 @@ namespace CompuLogic.Workspace
|
||||
return !Definition.HasState && (
|
||||
InputAnchors.Contains(target) ||
|
||||
InputAnchors.Any(a => a.HasInputAnchor(target))
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -101,8 +102,8 @@ namespace CompuLogic.Workspace
|
||||
var state = Definition.GetState(this).ToInt();
|
||||
if (state != _lastState)
|
||||
{
|
||||
Definition.Compute(this);
|
||||
_lastState = state;
|
||||
Definition.Compute(this);
|
||||
_lastState = state;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace CompuLogic.Workspace
|
||||
}
|
||||
|
||||
gate.GateType = (GateType)key;
|
||||
gate.CustomProperties = item.Properties;
|
||||
|
||||
gate.UIName = string.IsNullOrEmpty(item.Name) ? gate.GateType.ToString() : item.Name;
|
||||
|
||||
@@ -146,6 +147,7 @@ namespace CompuLogic.Workspace
|
||||
public List<string> Output { get; set; }
|
||||
public List<GateBookItemAnchor> InputAnchors => Input.Select(i => i.Split(new char[0])).Select(GateBookItemAnchor.Get).ToList();
|
||||
public List<GateBookItemAnchor> OutputAnchors => Output.Select(i => i.Split(new char[0])).Select(GateBookItemAnchor.Get).ToList();
|
||||
public List<float> Properties;
|
||||
}
|
||||
|
||||
public class GateBookItemAnchor
|
||||
|
||||
@@ -15,12 +15,20 @@ namespace CompuLogic.Workspace.Gates
|
||||
|
||||
#endregion
|
||||
|
||||
#region 100 - Special
|
||||
#region 100 - I/O
|
||||
|
||||
internal class INGate : NoneGate { }
|
||||
|
||||
internal class OUTGate : NoneGate { }
|
||||
|
||||
internal class CLK1Gate : NoneGate { }
|
||||
|
||||
internal class CLK2Gate : NoneGate { }
|
||||
|
||||
internal class CLK3Gate : NoneGate { }
|
||||
|
||||
internal class CLK4Gate : NoneGate { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 200 - Basic
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
// 100 - I/O
|
||||
IN = 100,
|
||||
OUT = 110,
|
||||
CLK1 = 120,
|
||||
CLK2 = 130,
|
||||
CLK3 = 140,
|
||||
CLK4 = 150,
|
||||
// 200 - Basic
|
||||
BUF = 200,
|
||||
AND = 210,
|
||||
|
||||
@@ -13,6 +13,42 @@ list:
|
||||
class: OutputGate
|
||||
input:
|
||||
- A 1.5 1.5 W big
|
||||
120:
|
||||
skin: clk
|
||||
name: CLK 1Hz
|
||||
width: 3
|
||||
height: 3
|
||||
class: ClockGate
|
||||
output:
|
||||
- Q 2.5 1.5 E
|
||||
properties: [ 1 ]
|
||||
130:
|
||||
skin: clk
|
||||
name: CLK 5Hz
|
||||
width: 3
|
||||
height: 3
|
||||
class: ClockGate
|
||||
output:
|
||||
- Q 2.5 1.5 E
|
||||
properties: [ 0.2 ]
|
||||
140:
|
||||
skin: clk
|
||||
name: CLK 10Hz
|
||||
width: 3
|
||||
height: 3
|
||||
class: ClockGate
|
||||
output:
|
||||
- Q 2.5 1.5 E
|
||||
properties: [ 0.1 ]
|
||||
150:
|
||||
skin: clk
|
||||
name: CLK 50Hz
|
||||
width: 3
|
||||
height: 3
|
||||
class: ClockGate
|
||||
output:
|
||||
- Q 2.5 1.5 E
|
||||
properties: [ 0.02 ]
|
||||
200:
|
||||
skin: buffer
|
||||
width: 3
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 996 B |
Executable
+130
@@ -0,0 +1,130 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5f750949f494f64b8baf51ddce0cddc
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 1
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" baseProfile="full"
|
||||
width="300" height="300" viewBox="0 0 300 300">
|
||||
<!-- <g style="stroke:rgb(0,0,255);stroke-width:2"> -->
|
||||
<!-- <line x1="0" y1="0" x2="500" y2="0"/> -->
|
||||
<!-- <line x1="0" y1="100" x2="500" y2="100"/> -->
|
||||
<!-- <line x1="0" y1="200" x2="500" y2="200"/> -->
|
||||
<!-- <line x1="0" y1="300" x2="500" y2="300"/> -->
|
||||
<!-- <line x1="0" y1="400" x2="500" y2="400"/> -->
|
||||
<!-- <line x1="0" y1="500" x2="500" y2="500"/> -->
|
||||
<!-- <line y1="0" x1="0" y2="500" x2="0"/> -->
|
||||
<!-- <line y1="0" x1="100" y2="500" x2="100"/> -->
|
||||
<!-- <line y1="0" x1="200" y2="500" x2="200"/> -->
|
||||
<!-- <line y1="0" x1="300" y2="500" x2="300"/> -->
|
||||
<!-- <line y1="0" x1="400" y2="500" x2="400"/> -->
|
||||
<!-- <line y1="0" x1="500" y2="500" x2="500"/> -->
|
||||
<!-- </g> -->
|
||||
<!-- <g style="stroke:rgb(255,0,0);stroke-width:1"> -->
|
||||
<!-- <line x1="0" y1="50" x2="500" y2="50"/> -->
|
||||
<!-- <line x1="0" y1="150" x2="500" y2="150"/> -->
|
||||
<!-- <line x1="0" y1="250" x2="500" y2="250"/> -->
|
||||
<!-- <line x1="0" y1="350" x2="500" y2="350"/> -->
|
||||
<!-- <line x1="0" y1="450" x2="500" y2="450"/> -->
|
||||
<!-- <line y1="0" x1="50" y2="500" x2="50"/> -->
|
||||
<!-- <line y1="0" x1="150" y2="500" x2="150"/> -->
|
||||
<!-- <line y1="0" x1="250" y2="500" x2="250"/> -->
|
||||
<!-- <line y1="0" x1="350" y2="500" x2="350"/> -->
|
||||
<!-- <line y1="0" x1="450" y2="500" x2="450"/> -->
|
||||
<!-- </g> -->
|
||||
<g style="stroke:black;stroke-width:20;fill:white">
|
||||
<path d="M 50 50 H 250 V 250 H 50 Z" />
|
||||
<path d="M 100 125 V 175 H 150 V 125 H 200 V 175 M 100 125" />
|
||||
</g>
|
||||
<!-- <g style="stroke:none;fill:green"> -->
|
||||
<!-- <circle cx="150" cy="150" r="40"/> -->
|
||||
<!-- </g> -->
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user