Skip to content

Commit 67cc8ad

Browse files
authored
Merge pull request #1 from firecerne/feat-RTC
Revert faulty merg
2 parents fa13055 + e2c60f1 commit 67cc8ad

45 files changed

Lines changed: 104 additions & 1634 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/Scripts/Description/Helpers/ChipTypeHelper.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ public static class ChipTypeHelper
1515
{ ChipType.Clock, "CLOCK" },
1616
{ ChipType.Pulse, "PULSE" },
1717
{ ChipType.TriStateBuffer, "3-STATE BUFFER" },
18-
{ ChipType.Constant_8Bit, "CONST" },
1918
// ---- Memory ----
20-
{ ChipType.dev_Ram_8Bit, "RAM-8" },
19+
{ ChipType.dev_Ram_8Bit, "dev.RAM-8" },
2120
{ ChipType.Rom_256x16, $"ROM 256{mulSymbol}16" },
22-
{ ChipType.EEPROM_256x16, $"EEPROM 256{mulSymbol}16" },
2321
// ---- Split / Merge ----
2422
{ ChipType.Split_4To1Bit, "4-1BIT" },
2523
{ ChipType.Split_8To1Bit, "8-1BIT" },
@@ -48,9 +46,6 @@ public static class ChipTypeHelper
4846
{ ChipType.Out_4Bit, "OUT-4" },
4947
{ ChipType.Out_8Bit, "OUT-8" },
5048
{ ChipType.Key, "KEY" },
51-
{ ChipType.Button, "BUTTON" },
52-
{ ChipType.Toggle, "DIPSWITCH" },
53-
5449
// ---- Buses ----
5550
{ ChipType.Bus_1Bit, "BUS-1" },
5651
{ ChipType.Bus_4Bit, "BUS-4" },
@@ -68,7 +63,7 @@ public static class ChipTypeHelper
6863

6964
public static bool IsBusTerminusType(ChipType type) => type is ChipType.BusTerminus_1Bit or ChipType.BusTerminus_4Bit or ChipType.BusTerminus_8Bit;
7065

71-
public static bool IsRomType(ChipType type) => type == ChipType.Rom_256x16 || type == ChipType.EEPROM_256x16;
66+
public static bool IsRomType(ChipType type) => type == ChipType.Rom_256x16;
7267

7368
public static ChipType GetCorrespondingBusTerminusType(ChipType type)
7469
{
@@ -116,15 +111,5 @@ public static (bool isInput, bool isOutput, PinBitCount numBits) IsInputOrOutput
116111
_ => (false, false, PinBitCount.Bit1)
117112
};
118113
}
119-
120-
public static bool IsClickableDisplayType(ChipType type) {
121-
// Return true for any chiptype that is a clickable display
122-
123-
return type == ChipType.Button || type == ChipType.Toggle;
124-
}
125-
126-
public static bool IsInternalDataModifiable(ChipType type) {
127-
return type == ChipType.EEPROM_256x16 || type == ChipType.Toggle;
128-
}
129114
}
130115
}

Assets/Scripts/Description/Types/SubTypes/ChipTypes.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public enum ChipType
1313
// ---- Memory ----
1414
dev_Ram_8Bit,
1515
Rom_256x16,
16-
EEPROM_256x16,
1716

1817
// ---- Displays ----
1918
SevenSegmentDisplay,
@@ -39,13 +38,14 @@ public enum ChipType
3938

4039
Key,
4140

41+
<<<<<<< HEAD
42+
=======
4243
Button,
4344
Toggle,
4445

45-
Constant_8Bit,
46-
47-
// ---- Buses ----
48-
Bus_1Bit,
46+
>>>>>>> parent of dbecdc9 (Merge pull request #8 from firecerne/constant)
47+
// ---- Buses ----
48+
Bus_1Bit,
4949
BusTerminus_1Bit,
5050
Bus_4Bit,
5151
BusTerminus_4Bit,

Assets/Scripts/Game/Elements/DisplayInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace DLS.Game
66
{
7-
public class DisplayInstance : IClickable
7+
public class DisplayInstance
88
{
99
public List<DisplayInstance> ChildDisplays;
1010
public DisplayDescription Desc;

Assets/Scripts/Game/Elements/SubChipInstance.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,6 @@ public void FlipBus()
378378
}
379379
}
380380

381-
public void UpdateInternalData(uint[] data)
382-
{
383-
if (!ChipTypeHelper.IsInternalDataModifiable(ChipType)) throw new Exception("Internal Data is not modifiable for the type of chip : " + ChipTypeHelper.GetName(ChipType));
384-
Array.Copy(data, InternalData, data.Length);
385-
}
386-
387381
void LoadOutputPinColours(OutputPinColourInfo[] cols)
388382
{
389383
if (cols == null) return;

Assets/Scripts/Game/Interaction/ChipInteractionController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class ChipInteractionController
5050
public bool CanInteractWithPin => CanInteract;
5151
public bool CanInteractWithPinStateDisplay => CanInteract && !IsCreatingWire && Project.ActiveProject.CanEditViewedChip;
5252
public bool CanInteractWithPinHandle => CanInteractWithPinStateDisplay;
53-
public bool CanInteractWithButton => CanInteract;
53+
5454

5555
public ChipInteractionController(Project project)
5656
{

Assets/Scripts/Game/Interaction/Interfaces/IClickable.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

Assets/Scripts/Game/Interaction/Interfaces/IClickable.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Assets/Scripts/Game/Project/BuiltinChipCreator.cs

Lines changed: 21 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ namespace DLS.Game
99
public static class BuiltinChipCreator
1010
{
1111
static readonly Color ChipCol_SplitMerge = new(0.1f, 0.1f, 0.1f); //new(0.8f, 0.8f, 0.8f);
12-
static bool AllBlack;
13-
static Color AllBlackColor = Color.black;
1412

15-
public static ChipDescription[] CreateAllBuiltinChipDescriptions(ProjectDescription description)
13+
public static ChipDescription[] CreateAllBuiltinChipDescriptions()
1614
{
17-
AllBlack = description.ProjectName.Contains("ahic");
18-
1915
return new[]
2016
{
2117
// ---- I/O Pins ----
@@ -26,21 +22,14 @@ public static ChipDescription[] CreateAllBuiltinChipDescriptions(ProjectDescript
2622
CreateInputOrOutputPin(ChipType.In_8Bit),
2723
CreateInputOrOutputPin(ChipType.Out_8Bit),
2824
CreateInputKeyChip(),
29-
CreateInputButtonChip(),
30-
CreateInputToggleChip(),
31-
3225
// ---- Basic Chips ----
3326
CreateNand(),
3427
CreateTristateBuffer(),
3528
CreateClock(),
3629
CreatePulse(),
37-
CreateConstant_8(),
38-
3930
// ---- Memory ----
4031
dev_CreateRAM_8(),
4132
CreateROM_8(),
42-
CreateEEPROM_8(),
43-
4433
// ---- Merge / Split ----
4534
CreateBitConversionChip(ChipType.Split_4To1Bit, PinBitCount.Bit4, PinBitCount.Bit1, 1, 4),
4635
CreateBitConversionChip(ChipType.Split_8To4Bit, PinBitCount.Bit8, PinBitCount.Bit4, 1, 2),
@@ -70,7 +59,7 @@ public static ChipDescription[] CreateAllBuiltinChipDescriptions(ProjectDescript
7059

7160
static ChipDescription CreateNand()
7261
{
73-
Color col = GetColor(new(0.73f, 0.26f, 0.26f));
62+
Color col = new(0.73f, 0.26f, 0.26f);
7463
Vector2 size = new(CalculateGridSnappedWidth(GridSize * 8), GridSize * 4);
7564

7665
PinDescription[] inputPins = { CreatePinDescription("IN B", 0), CreatePinDescription("IN A", 1) };
@@ -81,7 +70,7 @@ static ChipDescription CreateNand()
8170

8271
static ChipDescription CreateBuzzer()
8372
{
84-
Color col = GetColor(new(0, 0, 0));
73+
Color col = new(0, 0, 0);
8574

8675
PinDescription[] inputPins =
8776
{
@@ -115,7 +104,7 @@ static ChipDescription CreateRTC()
115104

116105
static ChipDescription dev_CreateRAM_8()
117106
{
118-
Color col = GetColor(new(0.85f, 0.45f, 0.3f));
107+
Color col = new(0.85f, 0.45f, 0.3f);
119108

120109
PinDescription[] inputPins =
121110
{
@@ -143,12 +132,17 @@ static ChipDescription CreateROM_8()
143132
CreatePinDescription("OUT A", 2, PinBitCount.Bit8)
144133
};
145134

146-
Color col = GetColor(new(0.25f, 0.35f, 0.5f));
135+
Color col = new(0.25f, 0.35f, 0.5f);
147136
Vector2 size = new(GridSize * 12, SubChipInstance.MinChipHeightForPins(inputPins, outputPins));
148137

149138
return CreateBuiltinChipDescription(ChipType.Rom_256x16, size, col, inputPins, outputPins);
150139
}
151140

141+
<<<<<<< HEAD
142+
static ChipDescription CreateInputKeyChip()
143+
{
144+
Color col = new(0.1f, 0.1f, 0.1f);
145+
=======
152146
static ChipDescription CreateEEPROM_8()
153147
{
154148
PinDescription[] inputPins =
@@ -171,74 +165,21 @@ static ChipDescription CreateEEPROM_8()
171165
return CreateBuiltinChipDescription(ChipType.EEPROM_256x16, size, col, inputPins, outputPins);
172166
}
173167

174-
static ChipDescription CreateConstant_8()
175-
{
176-
PinDescription[] outputPins =
177-
{
178-
CreatePinDescription("VALUE OUT", 0, PinBitCount.Bit8),
179-
};
180-
181-
Color col = new(0.1f, 0.1f, 0.1f);
182-
Vector2 size = Vector2.one * GridSize * 6;
183-
184-
return CreateBuiltinChipDescription(ChipType.Constant_8Bit, size, col, null, outputPins);
185-
}
186-
187-
188168
static ChipDescription CreateInputKeyChip()
189169
{
190170
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
171+
>>>>>>> parent of dbecdc9 (Merge pull request #8 from firecerne/constant)
191172
Vector2 size = new Vector2(GridSize, GridSize) * 3;
192173

193174
PinDescription[] outputPins = { CreatePinDescription("OUT", 0) };
194175

195176
return CreateBuiltinChipDescription(ChipType.Key, size, col, null, outputPins, null, NameDisplayLocation.Hidden);
196177
}
197178

198-
static ChipDescription CreateInputButtonChip()
199-
{
200-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
201-
Vector2 size = new Vector2(GridSize, GridSize) * 3;
202-
float displayWidth = size.x - GridSize *0.5f;
203-
204-
PinDescription[] outputPins = { CreatePinDescription("OUT", 0) };
205-
DisplayDescription[] displays =
206-
{
207-
new()
208-
{
209-
Position = Vector2.zero,
210-
Scale = displayWidth,
211-
SubChipID = -1
212-
}
213-
};
214-
215-
return CreateBuiltinChipDescription(ChipType.Button, size, col, null, outputPins, displays, NameDisplayLocation.Hidden);
216-
}
217179

218-
static ChipDescription CreateInputToggleChip()
219-
{
220-
Color col = GetColor(new(70, 130, 180));
221-
Vector2 size = new Vector2(1f, 2f) * GridSize;
222-
float displayWidth = size.x;
223-
224-
PinDescription[] outputPins = { CreatePinDescription("OUT", 0) };
225-
DisplayDescription[] displays =
226-
{
227-
new()
228-
{
229-
Position = Vector2.zero,
230-
Scale = displayWidth,
231-
SubChipID = -1
232-
}
233-
};
234-
235-
return CreateBuiltinChipDescription(ChipType.Toggle, size, col, null, outputPins, displays, NameDisplayLocation.Hidden);
236-
}
237-
238-
239-
static ChipDescription CreateTristateBuffer()
180+
static ChipDescription CreateTristateBuffer()
240181
{
241-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
182+
Color col = new(0.1f, 0.1f, 0.1f);
242183
Vector2 size = new(CalculateGridSnappedWidth(1.5f), GridSize * 5);
243184

244185
PinDescription[] inputPins = { CreatePinDescription("IN", 0), CreatePinDescription("ENABLE", 1) };
@@ -250,7 +191,7 @@ static ChipDescription CreateTristateBuffer()
250191
static ChipDescription CreateClock()
251192
{
252193
Vector2 size = new(GridHelper.SnapToGrid(1), GridSize * 3);
253-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
194+
Color col = new(0.1f, 0.1f, 0.1f);
254195
PinDescription[] outputPins = { CreatePinDescription("CLK", 0) };
255196

256197
return CreateBuiltinChipDescription(ChipType.Clock, size, col, null, outputPins);
@@ -259,7 +200,7 @@ static ChipDescription CreateClock()
259200
static ChipDescription CreatePulse()
260201
{
261202
Vector2 size = new(GridHelper.SnapToGrid(1), GridSize * 3);
262-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
203+
Color col = new(0.1f, 0.1f, 0.1f);
263204
PinDescription[] inputPins = { CreatePinDescription("IN", 0) };
264205
PinDescription[] outputPins = { CreatePinDescription("PULSE", 1) };
265206

@@ -286,7 +227,7 @@ static ChipDescription CreateBitConversionChip(ChipType chipType, PinBitCount bi
286227
float height = SubChipInstance.MinChipHeightForPins(inputPins, outputPins);
287228
Vector2 size = new(GridSize * 9, height);
288229

289-
return CreateBuiltinChipDescription(chipType, size, GetColor(ChipCol_SplitMerge), inputPins, outputPins);
230+
return CreateBuiltinChipDescription(chipType, size, ChipCol_SplitMerge, inputPins, outputPins);
290231
}
291232

292233
static string GetPinName(int pinIndex, int pinCount, bool isInput)
@@ -310,7 +251,7 @@ static ChipDescription CreateDisplay7Seg()
310251
CreatePinDescription("COL", 7)
311252
};
312253

313-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
254+
Color col = new(0.1f, 0.1f, 0.1f);
314255
float height = SubChipInstance.MinChipHeightForPins(inputPins, null);
315256
Vector2 size = new(GridSize * 10, height);
316257
float displayWidth = size.x - GridSize * 2;
@@ -333,7 +274,7 @@ static ChipDescription CreateDisplayRGB()
333274
float width = height;
334275
float displayWidth = height - GridSize * 2;
335276

336-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
277+
Color col = new(0.1f, 0.1f, 0.1f);
337278
Vector2 size = new(width, height);
338279

339280
PinDescription[] inputPins =
@@ -389,7 +330,7 @@ static ChipDescription CreateDisplayDot()
389330
float width = height;
390331
float displayWidth = height - GridSize * 2;
391332

392-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
333+
Color col = new(0.1f, 0.1f, 0.1f);
393334
Vector2 size = new(width, height);
394335

395336

@@ -445,7 +386,7 @@ static ChipDescription CreateBus(PinBitCount bitCount)
445386
PinDescription[] inputs = { CreatePinDescription(name + " (Hidden)", 0, bitCount) };
446387
PinDescription[] outputs = { CreatePinDescription(name, 1, bitCount) };
447388

448-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
389+
Color col = new(0.1f, 0.1f, 0.1f);
449390

450391
return CreateBuiltinChipDescription(type, BusChipSize(bitCount), col, inputs, outputs, null, NameDisplayLocation.Hidden);
451392
}
@@ -461,7 +402,7 @@ static ChipDescription CreateDisplayLED()
461402
float width = height;
462403
float displayWidth = height - GridSize * 0.5f;
463404

464-
Color col = GetColor(new(0.1f, 0.1f, 0.1f));
405+
Color col = new(0.1f, 0.1f, 0.1f);
465406
Vector2 size = new(width, height);
466407

467408

@@ -550,10 +491,5 @@ void AddPins(PinDescription[] pins)
550491
}
551492
}
552493
}
553-
554-
static Color GetColor(Color color)
555-
{
556-
return AllBlack ? AllBlackColor : color;
557-
}
558494
}
559495
}

0 commit comments

Comments
 (0)