Exemplo n.º 1
0
        private void GetFunctionBody(BinaryManager manager, EntityFactory.Entity item,
                                     out List <string> inputs, out List <string> outputs, out string arguments)
        {
            var pars = manager.Controller.GetFunctionParameters(item.Id);

            inputs    = new List <string>();
            outputs   = new List <string>();
            arguments = "";

            // Gets the variables with the function container id
            foreach (var v in pars)
            {
                var typeId   = manager.Controller.GetVariableType(v.Id);
                var realType = manager.Controller.GetEntityType(typeId);
                if (realType == CoreControl.EntityFactory.ENTITY.ENUM_TYPE)
                {
                    var ret = $"{enumNames[typeId]} {v.Name}";
                    inputs.Add(ret);
                }
                else
                {
                    inputs.Add(v.ToSerialString(manager.Controller));
                }
            }

            for (int i = 0; i < pars.Count; i++)
            {
                arguments += $"{{\"{pars[i].Name}\", ({manager.Controller.GetVariableValue(pars[i].Id).GetType().ToString()}) {pars[i].Name}}},";
            }
            foreach (var ret in manager.Controller.GetFunctionReturns(item.Id))
            {
                outputs.Add(ret.ToSerialString(manager.Controller));
            }
        }
Exemplo n.º 2
0
        public void GenerationFromControllerWithFunctonIds()
        {
            var _manager      = new BinaryManager();
            var functions     = new List <Entity>();
            var codeConverter = new DulyCodeConverter(_manager);

            //GenerateDulyFile();
            //GenerateMoreOrLess();
            //_manager.LoadCommandsFrom("test.duly");
            _manager.LoadCommandsFrom("moreOrLess.dnai");

            var ids = _manager.Controller.GetIds(EntityType.CONTEXT | EntityType.PUBLIC);

            foreach (var id in ids)
            {
                functions.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.FUNCTION, id));
            }
            //functions = _manager.Controller.GetEntitiesOfType(ENTITY.FUNCTION, ids[0]);
            codeConverter.ConvertCode(new List <int> {
                0
            });
            codeConverter.ConvertCode(new List <int> {
                0
            });
        }
Exemplo n.º 3
0
    private void Awake()
    {
        m_playerSaveData = BinaryManager.Load <PlayerSaveData>(dataname);
        if (m_playerSaveData == null)
        {
            InitData();
        }

        m_playerSkillLevel = m_playerSaveData.playerSkillLevelData;

        InitPlayerData();

#if UNITY_EDITOR
        if (dataSO == null)
        {
            dataSO = (PlayerDataScriptableObject)Resources.Load("Data/PlayerDataScript");
        }
        m_playerSaveData.level        = dataSO.level;
        m_playerSaveData.exp          = dataSO.exp;
        m_playerSaveData.gold         = dataSO.gold;
        m_playerSaveData.cash         = dataSO.cash;
        m_playerSaveData.fatigability = dataSO.fatigability;
#endif
        LoginTimeFatigabilityPlus();
        InvokeRepeating(nameof(TimeSave), 10f, 10f);
    }
Exemplo n.º 4
0
    public void WinLevel()
    {
        string currentLevel = SceneManager.GetActiveScene().name.Replace("Level", "");
        int    unlockLevel  = Convert.ToInt32(currentLevel) + 1;

        BinaryManager.UnlockLevel(unlockLevel);
    }
        public static Ncgr LoadNgcr(string argumentosImg)
        {
            string[] argSplit = argumentosImg.Split(',');

            BinaryReader leitorNclr = new BinaryReader(new MemoryStream(BinaryManager.GetFile(argSplit[1])));

            Nclr nclr = new Nclr(leitorNclr, argSplit[1]);

            BinaryReader leitorNgcr = new BinaryReader(new MemoryStream(BinaryManager.GetFile(argSplit[0])));
            Ncgr         ncgr;


            if (argumentosImg.Contains(".nscr"))
            {
                BinaryReader leitorNscr = new BinaryReader(new MemoryStream(BinaryManager.GetFile(argSplit[2])));
                Nscr         nscr       = new Nscr(leitorNscr, argSplit[2]);
                ncgr = new Ncgr(leitorNgcr, nclr, nscr, argSplit[0], argSplit[3]);
            }
            else if (argumentosImg.Contains(".ncer"))
            {
                BinaryReader leitorNscer = new BinaryReader(new MemoryStream(BinaryManager.GetFile(argSplit[2])));
                Ncer         ncer        = new Ncer(leitorNscer, argSplit[2]);
                ncgr = new Ncgr(leitorNgcr, nclr, ncer, argSplit[0], argSplit[3]);
            }
            else
            {
                ncgr = new Ncgr(leitorNgcr, nclr, argSplit[0], argSplit[2]);
            }

            return(ncgr);
        }
Exemplo n.º 6
0
        public void TestAstar()
        {
            var compiler  = new Compiler();
            var template  = new TemplateReader();
            var _manager  = new BinaryManager();
            var variables = new List <Entity>();
            var functions = new List <Entity>();
            var dataTypes = new List <Entity>();

            _manager.LoadCommandsFrom("AStarFix.dnai");
            var ids = _manager.Controller.GetIds(EntityType.CONTEXT | EntityType.PUBLIC);

            foreach (var id in ids)
            {
                dataTypes.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.DATA_TYPE, id));
                variables.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.VARIABLE, id));
                functions.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.FUNCTION, id));
            }
            //variables = _manager.Controller.GetEntitiesOfType(ENTITY.VARIABLE, ids[1]);
            //functions = _manager.Controller.GetEntitiesOfType(ENTITY.FUNCTION, ids[1]);
            //GenerateMoreOrLess(_manager, out List<Entity> variables, out List<Entity> functions);

            string code = template.GenerateTemplateContent(_manager, variables, functions, dataTypes);
            var    res  = compiler.Compile(code);

            res = compiler.Compile(code);
        }
Exemplo n.º 7
0
    private void LoginTimeFatigabilityPlus()
    {
        if (m_playerData.maxFatigability < m_playerSaveData.fatigability)
        {
            m_playerSaveData.saveTiem = System.DateTime.Now;
            BinaryManager.Save(m_playerSaveData, dataname);
            return;
        }

        System.TimeSpan tempTimeSpan = System.DateTime.Now - m_playerSaveData.saveTiem;

        while (tempTimeSpan < System.TimeSpan.Zero)
        {
            tempTimeSpan -= System.TimeSpan.FromSeconds(10f);

            m_playerSaveData.fatigability++;
            if (m_playerData.maxFatigability > m_playerSaveData.fatigability)
            {
                m_playerSaveData.fatigability = m_playerData.maxFatigability;
                break;
            }
        }

        m_playerData.fatigability = m_playerSaveData.fatigability;
        m_playerSaveData.saveTiem = System.DateTime.Now;

        BinaryManager.Save(m_playerSaveData, dataname);
    }
Exemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     pickup         = this.GetComponent <PickUp>();
     blockCreation0 = GameObject.Find("BlockGenerator0").GetComponent <BlockCreation>();
     blockCreation1 = GameObject.Find("BlockGenerator1").GetComponent <BlockCreation>();
     logicManager   = GameObject.Find("LogicManager").GetComponent <LogicManager>();
     binaryManager  = GameObject.Find("BinaryManager").GetComponent <BinaryManager>();
 }
Exemplo n.º 9
0
    public void SavePlayerData(PlayerData _playerData)
    {
        m_playerData = _playerData;

        m_playerSaveData.level        = m_playerData.level;
        m_playerSaveData.exp          = m_playerData.exp;
        m_playerSaveData.gold         = m_playerData.gold;
        m_playerSaveData.cash         = m_playerData.cash;
        m_playerSaveData.fatigability = m_playerData.fatigability;

        BinaryManager.Save(m_playerSaveData, dataname);
    }
Exemplo n.º 10
0
        public void TestUnityConverter()
        {
            var manager = new BinaryManager();

            //GenerateDulyFile();
            GenerateMoreOrLess();
            manager.LoadCommandsFrom("moreOrLess.duly");
            var unity = new DulyCodeConverter(manager);

            unity.ConvertCode();
            unity.ConvertCode();
        }
Exemplo n.º 11
0
    private void TimeSave()
    {
        m_playerSaveData.fatigability++;
        if (m_playerData.maxFatigability < m_playerSaveData.fatigability)
        {
            m_playerSaveData.fatigability = m_playerData.maxFatigability;
        }

        m_playerData.fatigability = m_playerSaveData.fatigability;
        m_playerSaveData.saveTiem = System.DateTime.Now;

        BinaryManager.Save(m_playerSaveData, dataname);
    }
Exemplo n.º 12
0
    public List <ColoredCubeData> LoadColoredCubes(string fileName)
    {
        switch (spawnMode)
        {
        case SpawnMode.XML:
            return(XMLManager.LoadDatabase(fileName).coloredCubeDatas);

        case SpawnMode.Binary:
            return(BinaryManager.LoadDatabase().coloredCubeDatas);

        default:
            return(null);
        }
    }
Exemplo n.º 13
0
    private void Awake()
    {
        m_stageData = BinaryManager.Load <AllStageData>(dataName);

        if (stageDataSO == null)
        {
            stageDataSO = (StageDataScriptableObject)Resources.Load("Data/StageDataSO");
        }

        if (m_stageData == null)
        {
            InitData();
        }

        ConnectData();

        BinaryManager.Save(m_stageData, dataName);
    }
Exemplo n.º 14
0
 /// <summary>
 /// Creates the form.
 /// </summary>
 public frmLobby()
 {
     InitializeComponent();
     myDelPlayer = new MyPlayer();
     myDelPlayer.ESoundPlayer += MyPlayerMainMusic;
     activeForm         = null;
     leftBorderBtn      = new Panel();
     leftBorderBtn.Size = new Size(7, 90);
     pnlMenu.Controls.Add(leftBorderBtn);
     this.Text           = string.Empty;
     this.ControlBox     = false;
     this.DoubleBuffered = true;
     threads             = new List <Thread>();
     smr           = new SerialManager <List <Robot> >();
     smb           = new SerialManager <List <MaterialBucket> >();
     serialManager = new SerialManager <List <MaterialBucket> >();
     textManager   = new TextManager();
     binManager    = new BinaryManager();
 }
Exemplo n.º 15
0
        public async void ExportarRom()
        {
            TxtDirNdsEstaAtivo     = false;
            BtnExportarEstaAtivo   = false;
            BtnSelecionarEstaAtivo = false;
            ConfigurationManager.SetarDiretorioRomDesmotanda($"{_diretorioDestino}\\ROM_Desmontada");
            ConfigurationManager.SalvarConfiguracoes();
            await Task.Run(() => NdsTool.ExportNdsFiles(_diretorioDaRom, ConfigurationManager.ObtenhaDiretorioRomDesmotanda()));

            await Task.Run(() => BinaryManager.Initialize());

            // GerenciadoEstaticoDeViewsModels.BinariosViewModel.VerificarListas();
            System.Windows.MessageBox.Show(NdsTool.Message);
            DiretorioDaRom         = "";
            DiretorioDestino       = "";
            TxtDirNdsEstaAtivo     = true;
            BtnExportarEstaAtivo   = true;
            BtnSelecionarEstaAtivo = true;
        }
Exemplo n.º 16
0
        public MainLogic(IUIRef ui, Translations translations, QuestionNamer namer, BinaryManager manager)
        {
            Ui = ui;
            this.translations = translations;
            this.namer        = namer;
            this.manager      = manager;

            if (!manager.categories.Any(s => s.CategoryUserFriendlyName == "custom"))
            {
                Ui.message("Konfiguracja programu");
                var core = new QuestionCategory();
                core.CategoryUserFriendlyName = "custom";
                core.UniquePath = "\\custom";
                translations.LessonDesc.Add("\\custom\tPytania Niestandartowe\tCustom Tasks\tНестандартные вопросы");
                manager.categories[0].SubcategoriesUniquePaths.Add("\\custom");
                manager.categories.Add(core);
                SaveAll();
            }

            custom = manager.categories.Find(s => s.CategoryUserFriendlyName == "custom");
        }
Exemplo n.º 17
0
        private void WriteInTypeFile(Log log)
        {
            switch (this.Type)
            {
            case FileAppenderType.JSON:

                JsonManager.WriteToJsonFile <Log>(Path, Name, log);
                break;

            case FileAppenderType.YAML:

                YamlManager.WriteToYamlFile <Log>(Path, Name, log);
                break;

            case FileAppenderType.XML:
                XmlManager.WriteToXmlFile <Log>(Path, Name, log);
                break;

            case FileAppenderType.CSV:

                CsvManager.WriteToCsvFile <Log>(Path, Name, log);
                break;

            case FileAppenderType.BINARY:

                BinaryManager.WriteToBinaryFile <Log>(Path, Name, log);
                break;

            case FileAppenderType.CHARACTER:
                CharacterManager.WriteToCharacterFile <Log>(Path, Name, log);
                break;

            case FileAppenderType.TEXT:
            default:

                this.WriteToTxtFile(log);
                break;
            }
        }
Exemplo n.º 18
0
    private void UnlockLevelButtons()
    {
        int levelUnlocked = BinaryManager.GetLevelUnlocked();

        if (levelUnlocked < 1)
        {
            levelUnlocked = 1;
        }
        if (levelUnlocked > 5)
        {
            levelUnlocked = 5;
        }
        var grid = FindObjectOfType <GridLayoutGroup>();

        for (int i = 0; i < levelUnlocked; i++)
        {
            Transform level = grid.transform.GetChild(i);
            level.GetComponent <Button>().enabled         = true;
            level.GetComponent <Image>().sprite           = unlockedImage;
            level.GetComponentInChildren <Text>().enabled = true;
        }
    }
Exemplo n.º 19
0
    private void InitData()
    {
        m_playerSaveData = new PlayerSaveData();
        m_playerSaveData.charactorName = "name";
        m_playerSaveData.level         = 1;
        m_playerSaveData.exp           = 0;
        m_playerSaveData.gold          = 0;
        m_playerSaveData.fatigability  = 10 + m_playerSaveData.level * 2;
        m_playerSaveData.inventoySize  = 30;


        m_playerSaveData.playerSkillLevelData = new PlayerSkillLevelData();
        m_playerSaveData.playerSkillLevelData.SkillLevelInfoDic = new Dictionary <string, int>();
        string[] skillNames = SkillDataManager.Inst.GetSkillNames();

        for (int i = 0; i < skillNames.Length; ++i)
        {
            m_playerSaveData.playerSkillLevelData.SkillLevelInfoDic.Add(skillNames[i], 1);
        }

        BinaryManager.Save(m_playerSaveData, dataname);
    }
Exemplo n.º 20
0
    public void SaveColoredCubes()
    {
        datas.Clear();
        foreach (Transform child in transform)
        {
            datas.Add(child.GetComponent <ColoredCube>().Data);
        }
        switch (saveMode)
        {
        case SaveMode.XML:
            XMLManager.Database.coloredCubeDatas = datas;
            XMLManager.SaveDatabase(fileName);
            break;

        case SaveMode.Binary:
            BinaryManager.Database.coloredCubeDatas = datas;
            BinaryManager.SaveDatabase();
            break;

        default:
            break;
        }
    }
Exemplo n.º 21
0
        /// <summary>
        /// Generates a custom object from the given entity.
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        private string CreateObject(BinaryManager manager, EntityFactory.Entity item)
        {
            var ret          = "class " + item.Name + "{";
            var funcList     = manager.Controller.GetEntitiesOfType(EntityFactory.ENTITY.FUNCTION, item.Id);
            var funcTemplate = new GenerateFunctionTemplate();

            var custom = new CustomObject(item, manager.Controller);

            foreach (var attrib in custom.Fields)
            {
                ret += "public " + custom.GetFieldType(attrib.Value) + " " + attrib.Key + ";";
            }

            //foreach (var func in funcList)
            //{
            //    var inputs = new List<string>();
            //    var outputs = new List<string>();
            //    funcTemplate.FunctionId = func.Id;
            //    GetFunctionBody(manager, func, out funcTemplate.Inputs, out funcTemplate.Outputs, out funcTemplate.FunctionArguments);
            //    ret += funcTemplate.TransformText();
            //}
            return(ret + "}");
        }
Exemplo n.º 22
0
        public void GenerationFromController()
        {
            var compiler  = new Compiler();
            var template  = new TemplateReader();
            var _manager  = new BinaryManager();
            var variables = new List <Entity>();
            var functions = new List <Entity>();
            var dataTypes = new List <Entity>();

            //GenerateDulyFile();
            GenerateMoreOrLess();
            _manager.LoadCommandsFrom("More Or Less.dnai");
            //GenerateMoreOrLess(_manager, out variables, out functions);

            var ids = _manager.Controller.GetIds(EntityType.CONTEXT | EntityType.PUBLIC);

            foreach (var id in ids)
            {
                dataTypes.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.DATA_TYPE, id));
                variables.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.VARIABLE, id));
                functions.AddRange(_manager.Controller.GetEntitiesOfType(ENTITY.FUNCTION, id));
            }
            //variables = _manager.Controller.GetEntitiesOfType(ENTITY.VARIABLE, ids[1]);
            //functions = _manager.Controller.GetEntitiesOfType(ENTITY.FUNCTION, ids[1]);
            //GenerateMoreOrLess(_manager, out List<Entity> variables, out List<Entity> functions);

            string code = template.GenerateTemplateContent(_manager, variables, functions, dataTypes);
            var    res  = compiler.Compile(code);

            res = compiler.Compile(code);
            var type = res.CompiledAssembly.GetType("DNAI.MoreOrLess.MoreOrLess");

            Assert.IsNotNull(type);
            var func = type.GetMethod("ExecutePlay");

            Assert.IsNotNull(func);
        }
Exemplo n.º 23
0
    public void SavePlayerData(PlayerData.DATA_ENUM _data_enum, int _value)
    {
        switch (_data_enum)
        {
        case PlayerData.DATA_ENUM.DATA_ENUM_LEVEL:
            m_playerSaveData.level = _value;
            break;

        case PlayerData.DATA_ENUM.DATA_ENUM_GOLD:
            m_playerSaveData.gold += _value;
            break;

        case PlayerData.DATA_ENUM.DATA_ENUM_CASH:
            m_playerSaveData.cash += _value;
            break;

        case PlayerData.DATA_ENUM.DATA_ENUM_FATIGABILITY:
            m_playerSaveData.fatigability = _value;
            break;
        }

        InitPlayerData();
        BinaryManager.Save(m_playerSaveData, dataname);
    }
Exemplo n.º 24
0
    void Start()
    {
        soundManager  = GameObject.Find("SoundManager").GetComponent <SoundManager>();
        binaryManager = GameObject.Find("BinaryManager").GetComponent <BinaryManager>();
        coinManager   = GameObject.Find("CoinManager").GetComponent <CoinManager>();

        //Laden der Bereits vorhandenen Upgrades aus den PlayerPrefs
        if (PlayerPrefs.GetInt("UpgradeLevelCPU") == 1)
        {
            upgradeLevel = 1;
            blocks[0].SetActive(true);
            binaryManager.cpuDestroyBlockTime = 4.5f;
            binaryManager.cpuCoinReward       = 10;
            upgradeCost = 20;
        }
        else if (PlayerPrefs.GetInt("UpgradeLevelCPU") == 2)
        {
            upgradeLevel = 2;
            blocks[1].SetActive(true);
            blocks[0].SetActive(true);
            binaryManager.cpuDestroyBlockTime = 4.2f;
            binaryManager.cpuCoinReward       = 15;
            upgradeCost = 30;
        }
        else if (PlayerPrefs.GetInt("UpgradeLevelCPU") == 3)
        {
            upgradeLevel = 3;
            blocks[2].SetActive(true);
            blocks[0].SetActive(true);
            blocks[1].SetActive(true);
            binaryManager.cpuDestroyBlockTime = 3.8f;
            binaryManager.cpuCoinReward       = 20;
            upgradeCost = 40;
        }
        else if (PlayerPrefs.GetInt("UpgradeLevelCPU") == 4)
        {
            upgradeLevel = 4;
            blocks[3].SetActive(true);
            blocks[0].SetActive(true);
            blocks[1].SetActive(true);
            blocks[2].SetActive(true);
            binaryManager.cpuDestroyBlockTime = 3.4f;
            binaryManager.cpuCoinReward       = 25;
            upgradeCost = 50;
        }
        else if (PlayerPrefs.GetInt("UpgradeLevelCPU") == 5)
        {
            upgradeLevel = 5;
            blocks[4].SetActive(true);
            blocks[0].SetActive(true);
            blocks[1].SetActive(true);
            blocks[2].SetActive(true);
            blocks[3].SetActive(true);
            binaryManager.cpuDestroyBlockTime = 3.0f;
            binaryManager.cpuCoinReward       = 30;
            upgradeCost = 0;
        }
        else
        {
            upgradeLevel = 0;
            upgradeCost  = 10;
        }
    }
        public static Btx LoadBtx(string argumentosImg)
        {
            BinaryReader br = new BinaryReader(new MemoryStream(BinaryManager.GetFile(argumentosImg.Split(',')[0])));

            return(new Btx(br, argumentosImg));
        }
Exemplo n.º 26
0
 protected override void Awake()
 {
     base.Awake();
     DontDestroyOnLoad(this);
     BinaryManager.Load();
 }
Exemplo n.º 27
0
 public DulyCodeConverter(BinaryManager manager)
 {
     _manager = manager;
 }
Exemplo n.º 28
0
 public void SaveSkillLevel()
 {
     m_playerSaveData.playerSkillLevelData = m_playerSkillLevel;
     BinaryManager.Save(m_playerSaveData, dataname);
 }
Exemplo n.º 29
0
 public void SaveStageData()
 {
     m_stageData.MainStageData = stageDataSO.MainStageData;
     m_stageData.maxStage      = stageDataSO.maxStage;
     BinaryManager.Save(m_stageData, dataName);
 }