Inheritance: Asset
Esempio n. 1
0
        /// <summary>
        /// Update the memory in the console.
        /// </summary>
        public static void UpdateMemory(ushort programCounter, byte stackPointer, int currentPage, Mem memory)
        {
            int baseX = 1, baseY = 16;

            // Zero page:
            for (int y = 0; y < 16; y++)
            {
                for (int x = 0; x < 16; x++)
                {
                    byte b = memory.Get(y * 16 + x);
                    AsciiRenderer.SetString(baseX + 1 + 2 * x, baseY + 2 + y, BM.ByteToHex(b),
                                            b == 0x00 ? very_dark_gray : white);
                }
            }

            int s_baseX = 40, s_baseY = 16;

            // Stack page:
            for (int y = 0; y < 16; y++)
            {
                for (int x = 0; x < 16; x++)
                {
                    int  n = y * 16 + x;
                    byte b = memory.Get(256 + n);
                    AsciiRenderer.SetString(s_baseX + 1 + 2 * x, s_baseY + 2 + y, BM.ByteToHex(b),
                                            b == 0x00 ? very_dark_gray : white, n == stackPointer ? blue : black);
                }
            }

            int sc_baseX = 1, sc_baseY = 36;
            int pc = -1;

            if (programCounter >= currentPage * 256 && programCounter < currentPage * 256 + 256)
            {
                pc = programCounter - currentPage * 256;
            }

            AsciiRenderer.SetString(sc_baseX, sc_baseY, $"{PageNumberToName(currentPage)} (${BM.UShortToHex((ushort)(currentPage * 256))}-${BM.UShortToHex((ushort)(currentPage * 256 + 255))}):       ", gray);

            // Current page:
            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 32; x++)
                {
                    int  n = y * 32 + x;
                    byte b = memory.Get(currentPage * 256 + n);
                    AsciiRenderer.SetString(sc_baseX + 1 + 2 * x, sc_baseY + 2 + y, BM.ByteToHex(b),
                                            b == 0x00 ? very_dark_gray : white, pc == n ? blue : black);
                }
            }

            int pa_baseX = 40, pa_baseY = 10;

            // Programmed Addresses:
            for (int x = 0; x < 6; x++)
            {
                byte b = memory.Get((int)Mem.MAX_MEM - 6 + x);
                AsciiRenderer.SetString(pa_baseX + 1 + 3 * x, pa_baseY + 2, BM.ByteToHex(b), b == 0x00 ? dark_gray : white);
            }
        }
Esempio n. 2
0
        public static string parseAntaraBM(string url)
        {
            WebClient W    = new WebClient();
            string    page = W.DownloadString(url);
            int       idx  = BM.bmMatch(page, "content_news") + 20;

            if (idx < 0)
            {
                Console.WriteLine("isi berita tidak ditemukan");
            }
            else
            {
                page = page.Substring(idx);
            }
            idx = BM.bmMatch(page, "mt10") - 10;
            if (idx < 0)
            {
                Console.WriteLine("isi berita tidak ditemukan");
            }
            else
            {
                page = page.Substring(0, idx);
            }
            idx = BM.bmMatch(page, "<br>");
            while (idx != -1)
            {
                string front = page.Substring(0, idx);
                string end   = page.Substring(idx + 4);
                page = front + end;
                idx  = BM.bmMatch(page, "<br>");
            }
            return(page);
        }
Esempio n. 3
0
 void MapShrinking(int _shrinking)
 {
     for (int x = 0; x <= roominfo.mapSize; x++)
     {
         for (int y = 0; y <= roominfo.mapSize; y++)
         {
             bool _xAct = x <= _shrinking || x >= roominfo.mapSize - _shrinking;
             bool _yAct = y <= _shrinking || y >= roominfo.mapSize - _shrinking;
             if (_xAct || _yAct)
             {
                 map.SetStatus(x, y, BlockState.unbrekable);
                 foreach (KeyValuePair <int, Client> _ply in allPlayer)
                 {
                     if (_ply.Value.alive)
                     {
                         bool _die = BM.Vec3To2int(PhotonView.Find(_ply.Value.plyInstancePvId).transform.position) == new Vector2Int(x, y);
                         if (_die)
                         {
                             StartCoroutine(KillPlayer(_ply.Value.plyInstancePvId));
                         }
                     }
                 }
             }
         }
     }
     StreamSendData(StreamDataType.Map);
 }
Esempio n. 4
0
        /// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew">是否插入</param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            // 这里验证参数范围,建议抛出参数异常,指定参数名,前端用户界面可以捕获参数异常并聚焦到对应的参数输入框
            if (BM.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(BM), "编码不能为空!");
            }

            // 在新插入数据或者修改了指定字段时进行修正
            // 货币保留6位小数
            DJ = Math.Round(DJ, 6);
            // 处理当前已登录用户信息,可以由UserModule过滤器代劳

            /*var user = ManageProvider.User;
             * if (user != null)
             * {
             *  if (isNew && !Dirtys[nameof(CreateUserID)]) CreateUserID = user.ID;
             *  if (!Dirtys[nameof(UpdateUserID)]) UpdateUserID = user.ID;
             * }*/
            //if (isNew && !Dirtys[nameof(CreateTime)]) CreateTime = DateTime.Now;
            //if (!Dirtys[nameof(UpdateTime)]) UpdateTime = DateTime.Now;
            //if (isNew && !Dirtys[nameof(CreateIP)]) CreateIP = ManageProvider.UserHost;
            //if (!Dirtys[nameof(UpdateIP)]) UpdateIP = ManageProvider.UserHost;

            // 检查唯一索引
            // CheckExist(isNew, __.BM);
        }
Esempio n. 5
0
    private void ExploseHere(Vector2 pose, int _owner)
    {
        foreach (KeyValuePair <int, Client> _ply in allPlayer)
        {
            if (_ply.Value.alive)
            {
                Vector2Int _plypose = BM.Vec3To2int(PhotonView.Find(_ply.Value.plyInstancePvId).gameObject.transform.position);
                if (_plypose == pose)
                {
                    allPlayer[_ply.Key].alive = false;
                    //PhotonView.Find(_ply.Value.plyInstancePvId).RequestOwnership();
                    //PhotonNetwork.Destroy(PhotonView.Find(_ply.Value.plyInstancePvId).gameObject);
                    StartCoroutine(KillPlayer(_ply.Value.plyInstancePvId));
                    if (_ply.Key != _owner)
                    {
                        allPlayer[_owner].kill += 1;
                    }
                    else
                    {
                        allPlayer[_owner].kill -= 1;
                    }
                }
            }
        }

        StreamSendData(StreamDataType.Players);
    }
Esempio n. 6
0
        private void generateButt_Click(object sender, RoutedEventArgs e)
        {
            long p, g;

            getRandPG(out p, out g);

            PField.Text = p.ToString();
            GField.Text = g.ToString();

            alise = new DH_Exschange(p, g);
            bob   = new DH_Exschange(p, g);

            ASKey.Text = alise.getSecretKey().ToString();
            BSKey.Text = bob.getSecretKey().ToString();

            long AM, BM;

            AM = alise.getMiddleKey();
            BM = bob.getMiddleKey();

            AMKey.Text = AM.ToString();
            BMKey.Text = BM.ToString();

            long AF, BF;

            AF = alise.getFinKey(BM);
            BF = bob.getFinKey(AM);

            AFKey.Text = AF.ToString();
            BFKey.Text = BF.ToString();
        }
Esempio n. 7
0
        /// <summary>
        /// Update the register values in the console.
        /// </summary>
        public static void UpdateRegisters(byte[] registers)
        {
            int baseX = 40, baseY = 6;

            AsciiRenderer.SetString(baseX + 3, baseY, BM.ByteToHex(registers[0]), (registers[0] == 0x00 ? dark_gray : white));
            AsciiRenderer.SetString(baseX + 9, baseY, BM.ByteToHex(registers[1]), (registers[1] == 0x00 ? dark_gray : white));
            AsciiRenderer.SetString(baseX + 15, baseY, BM.ByteToHex(registers[2]), (registers[2] == 0x00 ? dark_gray : white));
        }
Esempio n. 8
0
        /// <summary>
        /// Update the main processor values in the console.
        /// </summary>
        public static void UpdateMain(ushort programCounter, byte stackPointer, int cycles)
        {
            int baseX = 1, baseY = 4;

            AsciiRenderer.SetString(baseX + 4, baseY + 2, BM.UShortToHex(programCounter), (programCounter == 0xFFFC ? blue : white));
            AsciiRenderer.SetString(baseX + 13, baseY + 2, BM.ByteToHex(stackPointer), (stackPointer == 0x00 ? dark_gray : white));
            AsciiRenderer.SetString(baseX + 20, baseY + 2, cycles.ToString() + "   ", (cycles == 0 ? dark_gray : red));
        }
Esempio n. 9
0
    public void OnRestart()
    {
//		StartGame();//
        time         = 0;
        ShowedPlayer = false;
        BM.Reset();
        pC.gameObject.SetActive(false);
        pC.transform.localPosition = new Vector3(0, 4, 0);
    }
Esempio n. 10
0
 void _doEvent()
 {
     foreach (botManager BM in BMS)
     {
         BM._refresh();
         BM.GetComponentInParent <charWayPoints>()._setWayPointsEnd();
     }
     //Debug.Log("event");
 }
Esempio n. 11
0
    override public void DoDead()
    {
        BM.hero[sn].isDead = true;
        BM.FrameUpdate    -= AttackConuter;

        if (BM.hero[0].isDead && BM.hero[1].isDead)
        {
            BM.Gameover();
        }
    }
    static void Main()             //入口方法
    {
        Car c = new BM();          //创建BM对象

        c.Name  = "宝马";            //为Name字段赋值
        c.Color = "红色";            //为Color属性赋值
        c.show();                  //执行show()方法
        c.Run();                   //执行Run()方法
        c.Stop();                  //执行Stop()方法
        System.Console.ReadLine(); //等待回车继续
    }
Esempio n. 13
0
        //==========================================================
        public void GetMarkets(Bittrex B)
        {
            BittrexResult <List <BittrexMarket> > Markets = B.GetMarkets();

            if (GetIsResultValid(Markets))
            {
                foreach (BittrexMarket BM in Markets.Result)
                {
                    Console.WriteLine(BM.ToString());
                }
            }
        }
Esempio n. 14
0
    public bool UseMyteryPower(Client _ply)
    {
        Debug.LogFormat("Player {0} use {1}", _ply.name, _ply.GetPly().mysteryPower.ToString());
        switch (_ply.GetPly().mysteryPower)
        {
        case MysteryPowers.tp:
            if (roomManager.roominfo.safeTp)
            {
                Vector2Int tpPose;
                do
                {
                    tpPose = new Vector2Int(Random.Range(0, map.Maps.GetLength(0)), Random.Range(0, map.Maps.GetLength(1)));
                } while (!(tpPose.x % 2 == 1 && tpPose.y % 2 == 1));
                roomManager.MakeHole(tpPose.x, tpPose.y);
                photonView.RPC("TP", RpcTarget.All, tpPose.x + 0.5f, tpPose.y + 0.5f);
            }
            else
            {
                List <Vector2> _tpPosibilitis = new List <Vector2>();
                for (int y = 0; y < map.Maps.GetLength(1); y++)
                {
                    for (int x = 0; x < map.Maps.GetLength(0); x++)
                    {
                        if (map.Maps[x, y].state == BlockState.destroyer)
                        {
                            _tpPosibilitis.Add(new Vector2(x, y));
                        }
                    }
                }
                Vector2 _pos = _tpPosibilitis[Random.Range(0, _tpPosibilitis.Count)];
                photonView.RPC("TP", RpcTarget.All, _pos.x + 0.5f, _pos.y + 0.5f);
            }
            return(true);

        case MysteryPowers.megaBombe:
            Vector3 _bombePos = new Vector3(Mathf.Floor(transform.position.x), 0f, Mathf.Floor(transform.position.z));
            foreach (GameObject _bombe in GameObject.FindGameObjectsWithTag("Bombe"))
            {
                if (BM.Vec3To2int(_bombe.transform.position) == BM.Vec3To2int(_bombePos))
                {
                    return(false);
                }
            }
            StartCoroutine(roomManager.TimerBombe(_bombePos, photonView.OwnerActorNr, true));
            return(true);
        }
        return(false);
    }
Esempio n. 15
0
        public GOBBMViewer(BM bm)
            : base(bm)
        {
            _bm = bm;

            float edge = Mathf.Max(bm.Frames[0].Texture.width, bm.Frames[0].Texture.height);
            scale = Mathf.Clamp(64f / edge, 0.1f, 5f);

            frame = 0f;

            FPS = bm.FPS;

            if ((bm.Frames.Count > 1) && (FPS < 1)) {
                FPS = 1;
            }
        }
Esempio n. 16
0
    static void Main()                        //入口方法
    {
        Car        bmw    = new BM();         //基类对象引用子类实例,创建Car对象
        Car        benz   = new Benz();       //基类对象引用子类实例,创建Car对象
        Car        hongqi = new HongQi();     //基类对象引用子类实例,创建Car对象
        List <Car> LCar   = new List <Car>(); //创建集合对象

        LCar.Add(bmw);                        //向集合添加Car对象
        LCar.Add(benz);                       //向集合添加Car对象
        LCar.Add(hongqi);                     //向集合添加Car对象
        foreach (Car c in LCar)               //遍历集合
        {
            c.Run();                          //执行Run方法
        }
        Console.ReadLine();                   //等待回车继续
    }
Esempio n. 17
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();


        Bvaciar.ModifyBg(StateType.Normal, new Gdk.Color(150, 150, 150));
        BD.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BM.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BR.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BS.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        BI.ModifyBg(StateType.Normal, new Gdk.Color(112, 141, 242));
        // color de la pantalla
        ModifyBg(StateType.Normal, new Gdk.Color(8, 8, 8));
        //     label1.ModifyBg(StateType.Normal, new Gdk.Color(231, 231, 231));

        operaciones resultado = new operaciones();
    }
Esempio n. 18
0
 public void UpdateMap(List <Box> _boxSync)
 {
     for (int i = 0; i < transform.childCount; i++)
     {
         GameObject boxGo   = transform.GetChild(i).gameObject;
         Box        box     = null;
         bool       continu = false;
         foreach (Box boxInBoxsync in _boxSync)
         {
             if (BM.Vec3To2int(boxGo.transform.position) == boxInBoxsync.pos)
             {
                 box     = boxInBoxsync;
                 continu = true;
                 break;
             }
         }
         if (!continu)
         {
             continue;
         }
         GameObject gfx = boxGo.transform.Find("GFX").gameObject;
         if (gfx.activeSelf != box.GetBoxActive())
         {
             gfx.SetActive(box.GetBoxActive());
             boxGo.GetComponent <BoxCollider>().isTrigger = !box.GetBoxActive();
         }
         if (gfx.activeSelf)
         {
             if (gfx.GetComponent <Renderer>().material.color != box.GetBoxColor())
             {
                 gfx.GetComponent <Renderer>().material.color = box.GetBoxColor();
             }
             continue;
         }
         GameObject powerUpGFX = boxGo.transform.Find("PowerUP GFX").gameObject;
         if (powerUpGFX.activeSelf != box.GetPowerUpActive())
         {
             powerUpGFX.SetActive(box.GetPowerUpActive());
         }
         if (powerUpGFX.activeSelf && powerUpGFX.GetComponent <Renderer>().material.color != box.GetPowerUpColor())
         {
             powerUpGFX.GetComponent <Renderer>().material.color = box.GetPowerUpColor();
         }
     }
 }
Esempio n. 19
0
    /// <summary>
    /// 载入数据
    /// </summary>
    public override void loadData()
    {
        // 声明临时变量存放数据
        Data data = new Data();

        DataForPlayer playerdata = new DataForPlayer();

        // 从DataAssets获取数据至playerdata
        Operator.loadData(out data);

        playerdata = (DataForPlayer)data;
        // 同步数据至人物
        #region  步
        TotalHealth        = playerdata.TotalHealth;
        CurrentHealth      = playerdata.CurrentHealth;
        TotalEnergy        = playerdata.TotalEnergy;
        CurrentEnergy      = playerdata.CurrentEnergy;
        TotalHungerValue   = playerdata.TotalHungerValue;
        CurrentHungerValue = playerdata.CurrentHungerValue;
        Coins         = playerdata.Coins;
        ItemReference = playerdata.ItemReference;
        #endregion
        // 清空背包
        Bag.clearItem();
        // 更新背包
        Bag.LoadMode = true;
        foreach (ItemLoadIndex i in playerdata.ItemReference)
        {
            Item item = ItemStock.Instance.getItemByID(i.ID);
            item.setStatus(i.State);
            Bag.addItem(item, i.Count);
        }
        if (playerdata.BuffReference != null)
        {
            foreach (BuffLoadIndex b in playerdata.BuffReference)
            {
                Buff buff = BuffStock.findBuff(b.ID);
                buff.setStatus(b.State);
                BM.addBuff(buff);
            }
        }

        Bag.LoadMode             = false;
        Operator.DataAssets.Path = Application.dataPath + "/Save/" + CharacterName + "Data.txt";
    }
Esempio n. 20
0
    void CreatBombe(float _x, float _y, int _owner)
    {
        Vector3 _bombePos  = new Vector3(Mathf.Floor(_x), 0f, Mathf.Floor(_y));
        bool    _bombeHere = false;

        foreach (GameObject _bombe in GameObject.FindGameObjectsWithTag("Bombe"))
        {
            if (BM.Vec3To2int(_bombe.transform.position) == BM.Vec3To2int(_bombePos))
            {
                _bombeHere = true;
                break;
            }
        }

        if (!_bombeHere && allPlayer[_owner].GetPly().BombeCount < (int)allPlayer[_owner].GetPly().powerUps[PowerUps.moreBombe] + 1)
        {
            StartCoroutine(TimerBombe(_bombePos, _owner, false));
        }
    }
Esempio n. 21
0
    public static object Do(object Me, MethodBase M, List <object> O)
    {
        if ((!Description.SpecialVar) && (MList.L.Count > 0))
        {
            lock (MList.threadLock)
            {
                O = MList.L.Select(x => x);
                MList.L.Clear();
            }
        }
        var        e = Z.GetfromM(M);
        var        u = e.O.GetfromO(Me);
        MethodInfo BM, EM;

        if (u == null)
        {
            BM = e.BasicBeginM;
            EM = e.BasicEndM;
        }
        else
        {
            BM = u.BeginM;
            EM = u.EndM;
        }
        if (BM != null)
        {
            BM.Invoke(null, new object[] { Me, M, O });
        }

        byte[] R = e.BegCode;
        e.HandlersConditionsInst.ForEach(x => R = AOP.Handlers[x](R, Me, e, O));
        InjectionHelper.UpdateILCodes(M, R);
        object Res = M.Invoke(Me, O.ToArray());

        // InjectionHelper.UpdateILCodes(M, this.GetType().GetMethod("ORunner_" + O.Count.ToString()).GetMethodBody().GetILAsByteArray());
        InjectionHelper.UpdateILCodes(M, e.ChangeCode);
        if (EM != null)
        {
            EM.Invoke(null, new object[] { Res, Me, M, O });
        }
        return(Res);
    }
Esempio n. 22
0
    public void Toogle(int opcion)
    {
        switch (opcion)
        {
        case 0:
            LDC.SetActive(T_LDC.isOn);
            break;

        case 1:
            VM.SetActive(T_VM.isOn);
            break;

        case 2:
            BHX.SetActive(T_BHX.isOn);
            break;

        case 3:
            BHY.SetActive(T_BHY.isOn);
            break;

        case 4:
            BHZ.SetActive(T_BHZ.isOn);
            break;

        case 5:
            BM.SetActive(T_BM.isOn);
            break;

        case 6:
            MR.SetActive(T_MR.isOn);
            break;

        case 7:
            EDT.SetActive(T_EDT.isOn);
            break;

        case 8:
            CuerpoGO.SetActive(T_Cuerpo.isOn);
            break;
        }
    }
Esempio n. 23
0
        void DrawEndOsc(int OscPage = 0)
        {
            if (!G2Set || !G1Set)
            {
                var p = Parent.Parent.Parent as Form1;
                if (!G1Set)
                {
                    p.SetLastError("Настройки ГВЧ не заданы");
                }
                if (!G2Set)
                {
                    p.SetLastError("Настройки ГНЧ не заданы");
                }
                return;
            }
            var signal = new BM(harmonics, Source, ProceedInput(KEdit.Text), FilterKoef.Value / 10.0);

            OEnd = new Oscilloscope("BМ сигнал", signal, OscPage);
            OEnd.DrawOsc(Oscilloscope.FuncType.Modulated);
            OEnd.DrawPhaseSpec();
            OEnd.DrawSpec();
            OEnd.Show();
        }
Esempio n. 24
0
        private void RandomButtom_Click(object sender, EventArgs e)
        {
            SongImg.Image   = null;
            SelectedBeatmap = 0;
            RandomNumber    = BM.Rng();

            string temp = BM.DownloadJson(ApiCode, RandomNumber);

            JsonText = JsonConvert.DeserializeObject <List <Beatmap> >(temp);

            ChangeMainText();

            string result     = Path.GetTempPath() + "OsuDesktopTmp\\" + RandomNumber + ".jpg";
            string BeatmapImg = "https://assets.ppy.sh/beatmaps/" + RandomNumber + "/covers/cover.jpg";

            using (WebClient wc = new WebClient())
            {
                try
                {
                    wc.DownloadFile(new Uri(BeatmapImg), result);
                }
                catch (WebException)
                {
                    SongImg.Image = SongImg.ErrorImage;
                }
                finally
                {
                    if (SongImg.Image != SongImg.ErrorImage)
                    {
                        SongImg.Image = Bitmap.FromFile(result);
                    }
                }
            }

            BM.CreateTempFolder();
        }
Esempio n. 25
0
 /// <summary>
 /// 复活
 /// </summary>
 public override void revive()
 {
     if (Time.timeScale != 1)
     {
         Time.timeScale = 1;
     }
     BM.clearBuff();
     GameCharacterManager.Instance.reviveCharacter(this);
     IsDead = false;
     Rbody2D.gravityScale       = NormalGravityScale;
     LoadObj.transform.position = new Vector2(PlayerPrefs.GetFloat("recordX"), PlayerPrefs.GetFloat("recordY"));
     CurrentHealth      = TotalHealth;
     CurrentEnergy      = TotalEnergy;
     CurrentHungerValue = TotalHungerValue * 0.35f;
     Alive   = true;
     Eternal = false;
     Locked  = false;
     MoveAnim.SetBool("dead", false);
     if (GameCharacterManager.Instance.containPlayer(this) == false)
     {
         GameCharacterManager.Instance.addPlayer(this);
     }
     CurrentState = StateEnum.IDLE;
 }
Esempio n. 26
0
    public static BM.Frame ReadHeader1(ByteStream stream, BM.CreateArgs createArgs, out FMEHeader header)
    {
        header = new FMEHeader();
        header.Shift = new Vector2();
        header.Shift.x = (float)stream.ReadLittleInt32();
        header.Shift.y = (float)stream.ReadLittleInt32();
        header.Flipped = stream.ReadLittleInt32() != 0;

        int header2Ofs = stream.ReadLittleInt32();
        stream.Skip(16 + (header2Ofs-32));

        return ReadHeader2(stream, createArgs);
    }
Esempio n. 27
0
        public void Start()
        {
            // Debug second page.
            page = 2;

            // Create and reset cpu.
            mem = new Mem();
            cpu = new CPU();
            cpu.Reset(ref mem);

            #region JSR LDA RTS
            /// Start - Little inline program.

            mem[0xFFFC] = INS.JSR_AB; // Jump to Subroutine [6]
            mem[0xFFFD] = 0x03;
            mem[0xFFFE] = 0x02;
            ushort address = BM.CombineBytes(0x02, 0x03); // flip bytes for address

            mem[address]     = INS.LDA_IM;                // Load A Immediate [2]
            mem[address + 1] = 0x42;
            mem[address + 2] = INS.RTS_IP;                // Return from Subroutine [6]

            /// End - Little inline program.
            #endregion

            #region JMP_IN LDA
            /// Start - Little inline program.

            //mem[0xFFFC] = INS.JMP_IN; // Jump Indirect [5]
            //mem[0xFFFD] = 0x00;
            //mem[0xFFFE] = 0x03;
            //ushort indirect_address = BM.CombineBytes(0x03, 0x00); // flip bytes for address

            //mem[indirect_address] = 0x03;
            //mem[indirect_address + 1] = 0x02;
            //ushort address = BM.CombineBytes(0x02, 0x03); // flip bytes for address

            //mem[address] = INS.LDA_IM; // Load A Immediate [2]
            //mem[address + 1] = 0x42;

            /// End - Little inline program.
            #endregion

            /// Start - Little inline program.

            //mem[0xFFFC] = INS.JMP_AB; // Jump to 0x0200 (big endian)
            //mem[0xFFFD] = 0x00;
            //mem[0xFFFE] = 0x02;

            //mem[0x0200] = INS.LDA_IM; // Load Immediate 0x34
            //mem[0x0201] = 0x34;

            //mem[0x0202] = INS.STA_ZP; // Store to zero page 0x05
            //mem[0x0203] = 0x05;

            /// End - Little inline program.

            //cycles = cpu.ExecuteCycles(5 + 2, ref mem);

            // Request debug information.
            registers      = cpu.Registers();
            stackPointer   = cpu.StackPointer();
            programCounter = cpu.ProgramCounter();
            statusFlags    = cpu.StatusFlags();

            // Setup the console.
            ConsoleOutput.SetupConst();
        }
Esempio n. 28
0
    private void UpdateFloorUVs(LEV.Sector sector, BM bm, float shiftX, float shiftY, int ofs, Vector2[] outUVs)
    {
        BM.Frame frame = bm.Frames[0];
        float w = frame.Texture.width;
        float h = frame.Texture.height;
        float rw = frame.WRecip;
        float rh = frame.HRecip;

        for (int i = 0; i < sector.Vertices.Count; ++i) {
            Vector2 v = sector.Vertices[i];
            float s = -(v.x-shiftX)*8f;
            float t = -(v.y-shiftY)*8f;

            outUVs[ofs + i] = new Vector2(s*rw, 1f-(t*rh));
        }
    }
Esempio n. 29
0
    public static BM.Frame ReadHeader2(ByteStream stream, BM.CreateArgs createArgs)
    {
        int headerStart = (int)stream.Position;

        BM.Header header = new BM.Header();
        header.W = stream.ReadLittleInt32();
        header.H = stream.ReadLittleInt32();
        header.Compressed = stream.ReadLittleInt32();
        header.DataSize = stream.ReadLittleInt32();
        header.Transparent = 0x8;

        stream.Skip(8);

        int[] columnOffsets = null;

        if (header.Compressed != 0) {
            header.Compressed = 2;

            columnOffsets = new int[header.W];

            for (int i = 0; i < columnOffsets.Length; ++i) {
                columnOffsets[i] = stream.ReadLittleInt32() + headerStart;
            }
        }

        return BM.ReadColumns(stream, header, columnOffsets, createArgs);
    }
Esempio n. 30
0
    private void UpdateWallQuad(Sector sector, BM bm, int vertexOfs, Vector2 sv0, Vector2 sv1, float top, float bottom, bool pegBottom, float txShiftX, float txShiftY, bool flip)
    {
        Vector3 v0 = new Vector3(sv0.x, top, sv0.y);
        Vector3 v1 = new Vector3(sv1.x, top, sv1.y);
        Vector3 v2 = new Vector3(sv1.x, bottom, sv1.y);
        Vector3 v3 = new Vector3(sv0.x, bottom, sv0.y);

        sector.Vertices[vertexOfs + 0] = v0;
        sector.Vertices[vertexOfs + 1] = v1;
        sector.Vertices[vertexOfs + 2] = v2;
        sector.Vertices[vertexOfs + 3] = v3;

        float length = ((sv1 != sv0) ? (sv1 - sv0).magnitude : 0f) * 8f;
        float height = Mathf.Abs(bottom-top)*8;

        //txShiftX += sv0.x % (float)(bm.Frames[0].Texture.width);

        float uvLeft = txShiftX*bm.Frames[0].WRecip;
        float uvRight = (txShiftX + length)*bm.Frames[0].WRecip;

        if (flip) {
            uvLeft = -uvLeft;
            uvRight = -uvRight;
        }

        float txTop = (txShiftY * bm.Frames[0].HRecip);

        if (pegBottom) {
            txTop += (bm.Frames[0].Texture.height - height) * bm.Frames[0].HRecip;
        }

        float uvTop = txTop;
        float uvBottom = txTop + (height * bm.Frames[0].HRecip);

        Vector2 uv0 = new Vector2(uvLeft, 1f-uvTop);
        Vector2 uv1 = new Vector2(uvRight, 1f-uvTop);
        Vector2 uv2 = new Vector2(uvRight, 1f-uvBottom);
        Vector2 uv3 = new Vector2(uvLeft, 1f-uvBottom);

        sector.UVs[vertexOfs + 0] = uv0;
        sector.UVs[vertexOfs + 1] = uv1;
        sector.UVs[vertexOfs + 2] = uv2;
        sector.UVs[vertexOfs + 3] = uv3;
    }
Esempio n. 31
0
        public static string parseHTML(string url, int method)
        {
            switch (method)
            {
            case 0:
                if (KMP.kmpMatch(url, "detik.com") != -1)
                {
                    return(parseDetikKMP(url));
                }
                else if (KMP.kmpMatch(url, "tempo.co") != -1)
                {
                    return(parseTempoKMP(url));
                }
                else if (KMP.kmpMatch(url, "viva") != -1)
                {
                    return(parseVivaKMP(url));
                }
                else if (KMP.kmpMatch(url, "antara") != -1)
                {
                    return(parseAntaraKMP(url));
                }
                break;

            case 1:
                if (BM.bmMatch(url, "detik.com") != -1)
                {
                    return(parseDetikBM(url));
                }
                else if (BM.bmMatch(url, "tempo.co") != -1)
                {
                    return(parseTempoBM(url));
                }
                else if (BM.bmMatch(url, "viva") != -1)
                {
                    return(parseVivaBM(url));
                }
                else if (BM.bmMatch(url, "antara") != -1)
                {
                    return(parseAntaraBM(url));
                }
                break;

            case 2:
                if (RegexC.regexMatch(url, "detik.com") != -1)
                {
                    return(parseDetikRegex(url));
                }
                else if (RegexC.regexMatch(url, "tempo.co") != -1)
                {
                    return(parseTempoRegex(url));
                }
                else if (RegexC.regexMatch(url, "viva") != -1)
                {
                    return(parseVivaRegex(url));
                }
                else if (RegexC.regexMatch(url, "antara") != -1)
                {
                    return(parseAntaraRegex(url));
                }
                break;
            }
            return("Salah URL");
        }
Esempio n. 32
0
        public bool Draw(Shape shape)
        {
            if (shape != null)
            {
                using (Graph = Graphics.FromImage(BM))
                {
                    switch (shape.Name)
                    {
                    case ShapeEnumeration.square:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Rectangle square = new Rectangle(Convert.ToInt32(Central.X - shape.Dimension_1 / 2), Convert.ToInt32(Central.Y - shape.Dimension_1 / 2), shape.Dimension_1, shape.Dimension_1);
                        Graph.DrawRectangle(BlackPen, square);
                        break;

                    case ShapeEnumeration.rectangle:
                        if (shape.Dimension_2 == null)
                        {
                            shape.Dimension_2 = shape.Dimension_1;
                        }
                        Rectangle rectangle = new Rectangle(Convert.ToInt32(Central.X - shape.Dimension_2 / 2), Convert.ToInt32(Central.Y - shape.Dimension_1 / 2), shape.Dimension_2 ?? default(int), shape.Dimension_1);
                        Graph.DrawRectangle(BlackPen, rectangle);
                        break;

                    case ShapeEnumeration.scalenetriangle:
                        if (shape.Dimension_2 == null)
                        {
                            shape.Dimension_2 = shape.Dimension_1;
                        }
                        Graph.DrawPolygon(BlackPen, PointsForScaleneTriangle(shape));
                        break;

                    case ShapeEnumeration.isoscelestriangle:
                        if (shape.Dimension_2 == null)
                        {
                            shape.Dimension_2 = shape.Dimension_1;
                        }
                        Graph.DrawPolygon(BlackPen, PointsForIsoscelesTriangle(shape));
                        break;

                    case ShapeEnumeration.equilateraltriangle:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Graph.DrawPolygon(BlackPen, PointsForPolygon(3, Convert.ToInt32(GenarateRadius(3, shape.Dimension_1)) / 2));
                        break;

                    case ShapeEnumeration.parallelogram:
                        if (shape.Dimension_2 == null)
                        {
                            shape.Dimension_2 = shape.Dimension_1;
                        }
                        Graph.DrawPolygon(BlackPen, PointsForParallelogram(shape));
                        break;

                    case ShapeEnumeration.pentagon:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Graph.DrawPolygon(BlackPen, PointsForPolygon(5, Convert.ToInt32(GenarateRadius(5, shape.Dimension_1)) / 2));
                        break;

                    case ShapeEnumeration.hexagon:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Graph.DrawPolygon(BlackPen, PointsForPolygon(6, Convert.ToInt32(GenarateRadius(6, shape.Dimension_1)) / 2));
                        break;

                    case ShapeEnumeration.heptagon:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Graph.DrawPolygon(BlackPen, PointsForPolygon(7, Convert.ToInt32(GenarateRadius(7, shape.Dimension_1)) / 2));
                        break;

                    case ShapeEnumeration.octagon:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Graph.DrawPolygon(BlackPen, PointsForPolygon(8, Convert.ToInt32(GenarateRadius(8, shape.Dimension_1)) / 2));
                        break;

                    case ShapeEnumeration.circle:
                        if (shape.Dimension_2 != null)
                        {
                            return(false);
                        }
                        Graph.DrawEllipse(BlackPen, Central.X - shape.Dimension_1, Central.Y - shape.Dimension_1, shape.Dimension_1 * 2, shape.Dimension_1 * 2);
                        break;

                    case ShapeEnumeration.oval:
                        if (shape.Dimension_2 == null)
                        {
                            shape.Dimension_2 = shape.Dimension_1;
                        }
                        Graph.DrawEllipse(BlackPen, Convert.ToInt32(Central.X - 0.5 * shape.Dimension_2), Convert.ToInt32(Central.Y - 0.5 * shape.Dimension_1), shape.Dimension_2 ?? default(int), shape.Dimension_1);
                        break;
                    }
                }
                BM.Save("../Jeylabs_puzzle/wwwroot/images/shape.JPG");
                return(true);
            }
            return(false);
        }
Esempio n. 33
0
 public WinForm()
 {
     ApiCode = BM.GetApiCode();
     InitializeComponent();
 }
Esempio n. 34
0
        public override Action Behaviour()
        {
            if (Energy < WalkAction.StaticEnergyCost && Energy < EatFlowerAction.StaticEnergyCost)
            {
                return(new PassAction(this));
            }

            if (TileOfActor.BlockOfTile != null && TileOfActor.BlockOfTile.Name == "Flower")
            {
                FlowerPath = null;
                return(new EatFlowerAction(TileOfActor.BlockOfTile));
            }

            if (FlowerPath == null)
            {
                Tile FlowerTile = FindClosestFlower();
                if (FlowerTile == null)
                {
                    RandomTile = FindRandomTile();
                    if (RandomTile == null)
                    {
                        return(new PassAction(this));
                    }
                    else
                    {
                        return(new WalkAction(RandomTile));
                    }
                }
                else
                {
                    FlowerPath = BM.GetPathToTile(TileOfActor, FlowerTile, this);

                    if (FlowerPath == null)
                    {
                        RandomTile = FindRandomTile();
                        if (RandomTile == null)
                        {
                            return(new PassAction(this));
                        }
                        else
                        {
                            return(new WalkAction(RandomTile));
                        }
                    }
                    return(Behaviour());
                }
            }
            else
            {
                if (FlowerPath.Count != 0 && FlowerPath.Last().BlockOfTile != null && FlowerPath.Last().BlockOfTile.Name == "Flower")
                {
                    if (Methods.CanMoveActor(this, FlowerPath[0]))
                    {
                        return(new WalkAction(FlowerPath[0]));
                    }
                    else
                    {
                        FlowerPath = BM.GetPathToTile(TileOfActor, FlowerPath.Last(), this);
                        return(Behaviour());
                    }
                }
                else
                {
                    FlowerPath = null;
                    return(this.Behaviour());
                }
            }
        }
Esempio n. 35
0
    public void Load(string LEVname)
    {
        _lev = Asset.LoadCached<LEV>(LEVname + ".LEV");
        _pal = Asset.LoadCached<PAL>(_lev.Palette.ToUpper());
        _cmp = Asset.LoadCached<CMP>(LEVname + ".CMP");

        _game.SolidCMP.SetTexture("_PAL", _pal.Texture);
        _game.SolidCMP.SetTexture("_CMP", _cmp.Texture);

        BM.CreateArgs bmCreateArgs = new BM.CreateArgs();
        bmCreateArgs.Pal = _pal;

        if (_game.EmulateCMPShading) {
            bmCreateArgs.TextureFormat = TextureFormat.Alpha8;
            bmCreateArgs.AnisoLevel = 0;
            bmCreateArgs.FilterMode = FilterMode.Point;
            bmCreateArgs.bMipmap = false;
        } else {
            bmCreateArgs.TextureFormat = TextureFormat.RGBA32;
            bmCreateArgs.AnisoLevel = 9;
            bmCreateArgs.FilterMode = FilterMode.Trilinear;
            bmCreateArgs.bMipmap = true;
        }

        foreach (var texName in _lev.Textures) {
            try {
                BM bm = Asset.LoadCached<BM>(texName.ToUpper(), bmCreateArgs);
                _textures.Add(bm);
                if (_defaultTexture == null) {
                    _defaultTexture = bm;
                }
            } catch (System.IO.FileNotFoundException) {
                _textures.Add(null);
            }
        }

        GenerateSectors();
    }
Esempio n. 36
0
 private void Update()
 {
     if (Time.timeScale == 0)
     {
         return;
     }
     // check alive
     #region check alive
     if (Alive == false)
     {
         Locked           = true;
         Rbody2D.velocity = new Vector2(0, Rbody2D.velocity.y);
         if (!IsDead)
         {
             MoveAnim.SetBool("dead", true);
             goToDead(-1f);
         }
     }
     #endregion
     // Hunger
     #region Hunger
     if (TC.Minutes - TimeOnHold >= 1)
     {
         CurrentHungerValue -= HungerCost;
         TimeOnHold          = TC.Minutes;
     }
     if (CurrentHungerValue <= 0)
     {
         CurrentHungerValue = 0;
         if (!BM.containsBuff("Hungry0"))
         {
             BM.addBuff(BuffStock.findBuff("Hungry0"));
         }
     }
     else if (CurrentHungerValue >= TotalHungerValue)
     {
         CurrentHungerValue = TotalHungerValue;
     }
     #endregion
     // go to crouch
     #region go to crouch
     if ((Input.GetKeyDown(KeyCodeList.Instance.Crouch)) && OnGround == true && CurrentState != StateEnum.ATTACK)
     {
         IsCrouching = true;
     }
     else if (Input.GetKeyUp(KeyCodeList.Instance.Crouch) && CurrentState != StateEnum.ATTACK)
     {
         IsCrouching = false;
     }
     if (IsCrouching == true)
     {
         updateState(StateEnum.CROUCH);
     }
     else if (CurrentState == StateEnum.CROUCH)
     {
         finishCrouch();
     }
     #endregion
     // operation
     #region operation
     if (Locked == false && IsRolling == false && IsCrouching == false)
     {
         // go to jump
         #region    go to jump
         if (Input.GetKeyDown(KeyCodeList.Instance.Jump) && CurrentState != StateEnum.ATTACK &&
             IsHealing == false &&
             IsSpeeling == false)
         {
             if (OnGround == true && OnWall == false)
             {
                 IsJumping = true;
                 OnGround  = false;
                 updateState(StateEnum.JUMP, Direction, CurrentSpeed, CurrentJumpForce * (1 + (CurrentSpeed - WalkingSpeed) * 0.1f));
             }
             else if (ExtraJumpCount > 0 && IsSpeeling == false)
             {
                 // extra jump
                 if (CurrentEnergy >= JumpCost)
                 {
                     ExtraJumpCount--;
                     CurrentEnergy   -= JumpCost;
                     Rbody2D.velocity = new Vector2(0, 0);
                     updateState(StateEnum.JUMP, Direction, CurrentSpeed, CurrentJumpForce * ExtraJumpMultiple);
                 }
             }
         }
         #endregion
         // jump higher
         #region  jump higher
         if (Input.GetKey(KeyCodeList.Instance.Jump) && IsJumping == true)
         {
             if (CurrentJumpDuration > 0)
             {
                 Rbody2D.velocity    += Vector2.up * CurrentJumpForce * DeltaJumpForcePercent;
                 CurrentJumpDuration -= Time.deltaTime;
             }
             else
             {
                 IsJumping = false;
             }
         }
         if (Input.GetKeyUp(KeyCodeList.Instance.Jump))
         {
             IsJumping = false;
         }
         #endregion
         // go to attack
         #region  go to attack
         if (ChainsDuration > 0)
         {
             ChainsDuration -= Time.deltaTime;
         }
         else
         {
             ChainsDuration = 0;
             AttackNum      = 0;
         }
         if (CurrentCoolDown < CoolDown)
         {
             // 更新冷却
             CurrentCoolDown += Time.deltaTime;
         }
         if (CurrentCoolDown >= CoolDown && !IsRolling && !IsHealing)
         {
             if (Input.GetKeyDown(KeyCodeList.Instance.Attack) && OnGround == true)
             {
                 if (IsDashing)
                 {
                     finishDash();
                 }
                 // 重置冷却时间
                 CurrentCoolDown = 0;
                 if (ChainsDuration > 0)
                 {
                     // 连续攻击
                     if (AttackNum < MaxAttackNum)
                     {
                         AttackNum++;
                         ChainsDuration = MaxChainsDuration;
                     }
                     else
                     {
                         AttackNum      = 0;
                         ChainsDuration = MaxChainsDuration;
                     }
                 }
                 else
                 {
                     // 超时,重置
                     AttackNum      = 0;
                     ChainsDuration = MaxChainsDuration;
                 }
                 updateState(StateEnum.ATTACK, Direction, CurrentSpeed, CurrentJumpForce, true, AttackEnum.NORMAL_ATTACK);
                 Skill = AttackEnum.NORMAL_ATTACK;
             }
             if (Input.GetKeyDown(KeyCodeList.Instance.Attack) && OnGround == false && !IsSpeeling)
             {
                 // 重置冷却时间
                 CurrentCoolDown = 0;
                 updateState(StateEnum.ATTACK, Direction, CurrentSpeed, CurrentJumpForce, true, AttackEnum.JUMP_ATTACK);
                 Skill = AttackEnum.JUMP_ATTACK;
             }
             if (Input.GetKeyDown(KeyCodeList.Instance.Attack) && OnWall == true)
             {
                 // 重置冷却时间
                 CurrentCoolDown = 0;
                 updateState(StateEnum.ATTACK, Direction, CurrentSpeed, CurrentJumpForce, true, AttackEnum.SPEEL_ATTACK);
                 Skill = AttackEnum.SPEEL_ATTACK;
             }
         }
         #endregion
         //roll
         #region roll
         if (/*CurrentState != StateEnum.ATTACK && */ !IsRolling && !IsHealing &&
             checkGround() && CurrentEnergy >= RollingCost &&
             Input.GetKeyDown(KeyCodeList.Instance.Roll))
         {
             if (IsDashing)
             {
                 finishDash();
             }
             else
             {
                 CurrentEnergy -= RollingCost;
             }
             IsRolling = true;
             if (CurrentState == StateEnum.ATTACK)
             {
                 finishAttack(Skill);
             }
             MoveAnim.SetBool("roll", true);
             ChainsDuration = MaxChainsDuration;
         }
         #endregion
         // dash
         #region dash
         if (IsRunning && Input.GetKey(KeyCodeList.Instance.Dash) && checkGround() && !IsHealing)
         {
             if (CurrentEnergy > 0)
             {
                 IsDashing      = true;
                 CurrentEnergy -= Time.deltaTime * DashingCost;
             }
             else
             {
                 finishDash();
             }
         }
         else
         {
             finishDash();
         }
         #endregion
     }
     #endregion
     // cure energy
     #region cure energy
     if (!IsDashing && !IsRolling && !(IsRunning && OnGround) && !(IsJumping && ExtraJumpCount < MaxExtraJumpCount))
     {
         CurrentEnergy += Time.deltaTime * EnergyCure;
         if (CurrentEnergy > TotalEnergy)
         {
             CurrentEnergy = TotalEnergy;
         }
         else if (CurrentEnergy < 0)
         {
             CurrentEnergy = 0;
         }
     }
     #endregion
     // cure shield
     #region cure shield
     if (CurrentShieldValue < 0)
     {
         CurrentShieldValue = 0;
     }
     else if (CurrentShieldValue < TotalShieldValue)
     {
         CurrentShieldValue += Time.deltaTime * ShieldCure;
     }
     else if (CurrentShieldValue > TotalShieldValue)
     {
         CurrentShieldValue = TotalShieldValue;
     }
     #endregion
 }