-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[demon] begin work on CC Standard API
- Loading branch information
1 parent
1ca7872
commit 28b0b09
Showing
7 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace M64MM.Utils { | ||
public enum CCStandardPart { | ||
PANTS, | ||
HAT, | ||
GLOVES, | ||
SHOES, | ||
SKIN, | ||
HAIR, | ||
SHIRT, | ||
SHIRT_SHOULDER, | ||
SHIRT_ARM, | ||
OVERALLS_TOP, | ||
OVERALLS_BOTTOM, | ||
LEGS_TOP, | ||
LEGS_BOTTOM, | ||
CUSTOM1, | ||
CUSTOM2, | ||
CUSTOM3, | ||
CUSTOM4, | ||
CUSTOM5, | ||
CUSTOM6, | ||
CUSTOM7, | ||
CUSTOM8, | ||
LEGACY_CHARA_TINT, // X3S and others | ||
LEVEL_TINT1, | ||
LEVEL_TINT2, // Anything beyond is futureproofing | ||
LEVEL_TINT3, | ||
LEVEL_TINT4 | ||
} | ||
|
||
public static class CCStandardHelpers { | ||
public static readonly CCStandardPart[] SparkStandard = new CCStandardPart[] { | ||
CCStandardPart.SHIRT, CCStandardPart.SHIRT_ARM, CCStandardPart.SHIRT_SHOULDER, | ||
CCStandardPart.OVERALLS_BOTTOM, CCStandardPart.LEGS_TOP, CCStandardPart.LEGS_BOTTOM, | ||
CCStandardPart.CUSTOM1, CCStandardPart.CUSTOM2, CCStandardPart.CUSTOM3, CCStandardPart.CUSTOM4, | ||
CCStandardPart.CUSTOM5, CCStandardPart.CUSTOM6, CCStandardPart.CUSTOM7, CCStandardPart.CUSTOM8 | ||
}; | ||
|
||
public static readonly CCStandardPart[] ColorcodeableStandard = new CCStandardPart[] { | ||
CCStandardPart.SHIRT, CCStandardPart.SHIRT_ARM, CCStandardPart.SHIRT_SHOULDER, | ||
CCStandardPart.OVERALLS_BOTTOM, CCStandardPart.LEGS_TOP, CCStandardPart.LEGS_BOTTOM, | ||
CCStandardPart.CUSTOM1, CCStandardPart.CUSTOM2, CCStandardPart.CUSTOM3, CCStandardPart.CUSTOM4, | ||
CCStandardPart.CUSTOM5, CCStandardPart.CUSTOM6, CCStandardPart.CUSTOM7, CCStandardPart.CUSTOM8 | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace M64MM.Utils { | ||
public class Lightset { | ||
private Dictionary<string, ColorPart> _parts; | ||
private Dictionary<CCStandardPart, string> _partMapping; | ||
|
||
public bool SparkCompatible { | ||
get | ||
{ | ||
return _partMapping.Keys.Any(x => CCStandardHelpers.SparkStandard.Contains(x)); | ||
} | ||
} | ||
|
||
public bool NormalColorcodeCompatible | ||
{ | ||
get | ||
{ | ||
return _partMapping.Keys.Any(x => CCStandardHelpers.ColorcodeableStandard.Contains(x)); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Sets a ColorPart to a given ID. If the ID exists, it's overwritten. If the ColorPart is already assigned, the previous entry is erased. | ||
/// </summary> | ||
/// <param name="id">An ID to get the part by</param> | ||
/// <param name="part">The CC part to set</param> | ||
public void SetPart(string id, ColorPart part) { | ||
if (_parts.ContainsKey(id)) { | ||
_parts[id] = part; | ||
} | ||
else { | ||
if (_parts.Values.Contains(part)) { | ||
_parts.Remove(_parts.FirstOrDefault(x => x.Value == part).Key); | ||
} | ||
_parts.Add(id, part); | ||
} | ||
} | ||
|
||
public void SetPartMapping(CCStandardPart source, string id) { | ||
if (!_parts.ContainsKey(id)) { | ||
throw new ArgumentException($"This Lightset has no part with ID \"{id}\"."); | ||
} | ||
|
||
if (_partMapping.ContainsKey(source)) { | ||
_partMapping[source] = id; | ||
} | ||
else { | ||
_partMapping.Add(source, id); | ||
} | ||
} | ||
|
||
public ColorPart GetPartById(string id) | ||
{ | ||
if (!_parts.ContainsKey(id)) return null; | ||
|
||
return _parts[id]; | ||
} | ||
|
||
public ColorPart GetPart(CCStandardPart stdPart) { | ||
return GetPartById(_partMapping[stdPart]); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,7 +244,7 @@ public enum ModelHeaderType { | |
} | ||
}; | ||
|
||
public enum ShadowParts { | ||
public enum ShadowAxis { | ||
X, | ||
Y, | ||
Z | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters