Example #1
0
 private void WinSetup(SymbolDescriptor winner)
 {
     tieDisplay.SetActive(false);
     winDisplay.SetActive(true);
     SetResultText(winDisplay, "Won");
     winDisplay.GetComponentInChildren <Image>().sprite = winner.icon;
 }
        public void Option_names_are_as_expected(Type utilType, bool useArg)
        {
            var name       = useArg ? "MyPropertyArg" : "MyProperty";
            var cSharpCode = @$ "public int {name} {{ get; set; }}";
            var vBasicCode = @$ "Public Property {name} As Integer";

            var actualCli = LanguageUtils.Choose(utilType, cSharpCode, vBasicCode)
                            .WrapInClass()
                            .CliDescriptorForClass(out var code);

            SymbolDescriptor actual = useArg
                        ? actualCli.CommandDescriptor.Arguments.First()
                        : actualCli.CommandDescriptor.Options.First();

            actual.OriginalName.Should().Be(name);
            actual.Name.Should().Be("MyProperty");
            actual.CliName.Should().Be(useArg ? "my-property" : "--my-property");
        }
    public void OnEnable()
    {
        Debug.Log("SymbolDescriptor::OnEnable()");

        switch (symbol)
        {
        case Game.Symbol.Cross:
            Cross = this;
            break;

        case Game.Symbol.Circle:
            Circle = this;
            break;

        default:
            break;
        }
    }
Example #4
0
        private static string GenerateComment(ValueTypeDescriptor type, FieldDescriptor field)
        {
            string comment = null;

            if (field.IsEnum())
            {
                comment = " // " + string.Join(", ", SymbolDescriptor.GetAllSymbols(field.x38_SymbolTable).Select(a => a.GetName() + " = " + a.x00_Id));
            }
            else if (field.IsTranslateable())
            {
                comment = string.Format(" // TranslateFromString = 0x{0:X8}, TranslateFromValue = 0x{1:X8}",
                                        field.x40_TranslateFromString, field.x44_TranslateFromValue);
            }
            else if (field.IsTagMap())
            {
                comment = " // type: 0x" + field.x34.ToString("X8");
            }
            return(comment);
        }
Example #5
0
    // Marking
    private void BaseSetup(SymbolDescriptor newSymbol, bool colliderEnabled)
    {
        if (newSymbol != symbol)
        {
            symbol = newSymbol;
            thisCollider.enabled = colliderEnabled;

            Transform previousSymbolDisplay = transform.Find("Symbol");

            if (previousSymbolDisplay != null)
            {
                Destroy(previousSymbolDisplay.gameObject);
            }

            GameObject symbolDisplay = Instantiate(symbol.shape, gameObject.transform.position, Quaternion.identity);
            symbolDisplay.name             = "Symbol";
            symbolDisplay.transform.parent = gameObject.transform;
            //symbolDisplay.transform.position = Vector3.zero;
        }
    }
Example #6
0
        public static SymbolDescriptor ParseSymbol(string name)
        {
            var descr = new SymbolDescriptor();
            var index = name.IndexOf(PackageSymbolSeparator);

            if (index == 0)
            {
                descr.Package     = KeywordPackage;
                descr.PackageName = "keyword";
                descr.IsPublic    = true;
                descr.SymbolName  = name.Substring(1);
                descr.SymbolName  = descr.SymbolName.TrimStart(PackageSymbolSeparator);
                if (descr.SymbolName.Length == 0)
                {
                    throw new LispException("Keyword name cannot be null or blank");
                }
                return(descr);
            }

            if (index == -1)
            {
                if (SetupMode)
                {
                    descr.Package     = LispPackage;
                    descr.PackageName = "lisp";
                    descr.IsPublic    = true;
                }
                else
                {
                    descr.Package     = CurrentPackage();
                    descr.PackageName = "";
                    descr.IsPublic    = false;
                }

                descr.SymbolName = name;
                if (descr.SymbolName.Length == 0)
                {
                    throw new LispException("Symbol name cannot be null or blank");
                }
                return(descr);
            }

            if (index + 1 < name.Length && name[index + 1] == PackageSymbolSeparator)
            {
                // two consecutives colons
                descr.IsPublic    = false;
                descr.PackageName = name.Substring(0, index);
                descr.SymbolName  = name.Substring(index + 2);
            }
            else
            {
                // one colon
                descr.IsPublic    = true;
                descr.PackageName = name.Substring(0, index);
                descr.SymbolName  = name.Substring(index + 1);
            }

            if (descr.SymbolName.Length == 0)
            {
                throw new LispException("Symbol name cannot be null or blank: {0}", name);
            }

            if (descr.PackageName == "")
            {
                descr.PackageName = "keyword";
            }

            descr.Package = FindPackage(descr.PackageName);

            if (SetupMode && descr.PackageName == null)
            {
                descr.Package = MakePackage(descr.PackageName);
            }

            return(descr);
        }
 private void RefreshCurrentSymbol(SymbolDescriptor newCurrentSymbol)
 {
     SymbolImage.sprite = currentSymbol.Value.icon;
     SymbolImage.color  = currentSymbol.Value.color;
     SymbolText.text    = currentSymbol.Value.symbol.ToString();
 }
Example #8
0
 public void Mark(SymbolDescriptor symbol)
 {
     BaseSetup(symbol, false);
 }
Example #9
0
        public static SymbolDescriptor ParseSymbol(string name)
        {
            var descr = new SymbolDescriptor();
            var index = name.LastIndexOf(PackageSymbolSeparator);

            if (index == 0)
            {
                descr.Package = KeywordPackage;
                descr.PackageName = "keyword";
                descr.Exported = true;
                descr.SymbolName = name.Substring(1);
                if (descr.SymbolName.Length == 0)
                {
                    throw new LispException("Keyword name cannot be null or blank");
                }
                return descr;
            }

            if (index == -1)
            {
                if (Symbols.Package == null)
                {
                    descr.Package = LispPackage;
                    descr.PackageName = "lisp";
                    descr.Exported = true;
                }
                else {
                    descr.Package = CurrentPackage();
                    descr.PackageName = "";
                    descr.Exported = false;
                }

                descr.SymbolName = name;
                if (descr.SymbolName.Length == 0)
                {
                    throw new LispException("Symbol name cannot be null or blank");
                }
                return descr;
            }

            if (index > 0 && name[index - 1] == PackageSymbolSeparator)
            {
                // two consecutives colons
                descr.Exported = false;
                descr.PackageName = name.Substring(0, index - 1);
                descr.SymbolName = name.Substring(index + 1);
            }
            else {
                // one colon
                descr.Exported = true;
                descr.PackageName = name.Substring(0, index);
                descr.SymbolName = name.Substring(index + 1);
            }

            if (descr.SymbolName.Length == 0)
            {
                throw new LispException("Symbol name cannot be null or blank: {0}", name);
            }

            if (descr.PackageName == "")
            {
                descr.PackageName = "keyword";
            }

            descr.Package = MakePackage(descr.PackageName);

            return descr;
        }
Example #10
0
    public void WinPopup(PlayerGame game_, SymbolDescriptor winner)
    {
        ResultPopup resultPopup = MakePopup(game_);

        resultPopup.WinSetup(winner);
    }