예제 #1
0
    //Pick up memdata
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Pickup")
        {
            //Try and pick up their thing
            MemoryPickup pickup = other.GetComponent <MemoryPickup>();
            int          slot   = FirstEmptySlot();
            if (pickup && slot != -1)
            {
                if (!MemoryContains(pickup.data))
                {
                    memory[slot] = pickup.data;
                    UpdateUI();
                    pickup.Hide();
                    if (pickup.data.name.IndexOf("L.") != -1)
                    {
                        string text = "Launch Codes Aqquired!";

                        if (++codeCount == 3)
                        {
                            text += " Return back to the start to complete mission";
                        }
                        ShowPopup(text);
                    }
                    sound.Play(getData);
                }
                else
                {
                    ShowPopup("You already have that data!");
                }
            }
            else
            {
                ShowPopup("Out of free memory!");
            }
        }
        else if (other.tag == "Room")
        {
            //We have entered a new room
            currentRoom = other.GetComponent <RoomController>();
            AddRoomToMemory();
            MoveIndicator();
        }
        else if (other.tag == "Door")
        {
            DoorController d = other.GetComponent <DoorController>();
            if (!MemoryContains(d.keyCode))
            {
                ShowPopup("You need the <i>" + d.keyCode.name + "</i> to access this!");
            }
        }
    }
예제 #2
0
    private void OnCollisionEnter2D(Collision2D col)
    {
        var x = _force.x;
        var y = _force.y * -1;

        if (col.gameObject.name.Contains("pad"))
        {
            if (col.contactCount > 0)
            {
                var contacts = new ContactPoint2D[1];
                col.GetContacts(contacts);

                var contact = contacts[0];
                var bounds  = contact.collider.bounds;

                const float BALL_HEIGHT = 0.5f;

                y = contact.point.y.Remap(
                    (Mathf.Abs(bounds.min.y) + BALL_HEIGHT) * Mathf.Sign(bounds.min.y),
                    (Mathf.Abs(bounds.max.y) + BALL_HEIGHT) * Mathf.Sign(bounds.max.y),
                    -1,
                    1);
            }

            x *= -1;

            _speed *= SpeedIncrease;
        }

        _force = new Vector2(x, y);

        SoundHelper.Play(SoundHelper.Audios.Plop);
    }
예제 #3
0
        /// <summary>
        /// 显示
        /// </summary>
        private void Show()
        {
            if (isShow)
            {
                return;
            }

            isShow = true;

            storyboard = new Storyboard();

            newTop = 0;

            animation = CreateDoubleAnimation(this.Margin.Top, newTop, this, 200);

            storyboard.Children.Add(animation);

            storyboard.Completed += storyboard_Completed;

            storyboard.Begin(this);

            // 播放音乐
            //SoundHelperBak.PlaySound(AppDomain.CurrentDomain.BaseDirectory + "Data\\Alarm.wav");
            soundHelper.Play();
        }
예제 #4
0
        public static void SetAllowedItem(FindersKeepers.Helpers.Item Item, FilterItems Filter, bool ValidItem)
        {
            if ((!Config.Get <FKConfig>().General.FKSettings.DebugMode&& (Filter.OnlyAncient && !Item.AncientItem)))
            {
                return;
            }

            //if (!ValidItem) // Check this!! Not triggering in debug mode
            //  return;

            FKAccounts.Multibox Box = null;

            if (Filter.UseVoice)
            {
                SoundHelper.PlayVoice(Filter, Item);
            }

            else if (Filter.MultiboxSound)
            {
                SoundHelper.Play(Filter, GameManagerAccountHelper.CurrentData.Multibox.MultiboxID);
            }

            else if (Filter.SoundEnabled)
            {
                // SoundHelper.Play(Filter.SoundPath);

                if (Config.Get <FKConfig>().General.FKSettings.WriteToFile&& Item.ItemQuality == ItemQuality.Legendary)
                {
                    SoundHelper.OutputToFile(Item, GameManagerAccountHelper.CurrentData.Multibox.Nickname);
                }
            }

            Item.ShowAncient = Filter.ShowIfAncient;

            if (GameManager.Instance.GManager.GCache.Multiboxing)
            {
                if ((GameManagerAccountHelper.CurrentData.Multibox.Foreground != null && GameManagerAccountHelper.CurrentData.Multibox.TextColor != null) && GameManagerAccountHelper.CurrentData.Multibox.TextColor.Length > 0)
                {
                    Box = GameManagerAccountHelper.CurrentData.Multibox;
                }
            }

            if (Filter.OverlayIngame)
            {
                GameManager.Instance.GManager.GRef.D3OverlayControl.ItemOverlay.Add(
                    new OverlayItems {
                    Account    = Box,
                    Item       = new OverlayItems.SimpleItem(Item),
                    ItemType   = OverlayItems.Type.Item,
                    Transition = Filter.OverlayTimer
                });
            }
            //GameManager.Instance.GManager.GRef.ItemOverlay.Add(new OverlayItems { Account = Box, Item = new OverlayItems.SimpleItem(Item), ItemType = OverlayItems.Type.Item, Transition = Filter.OverlayTimer });
        }
예제 #5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.attachedRigidbody.position.x < 0)
        {
            GameContainer.Score.Player1++;
        }
        else
        {
            GameContainer.Score.Player2++;
        }

        _ball.Initiate();
        SoundHelper.Play(SoundHelper.Audios.Beep);
    }
예제 #6
0
        /// <summary>
        /// 扫码检票
        /// </summary>
        /// <param name="no"></param>
        /// <returns></returns>
        private TicketInfo_QD ScanCheck(string no)
        {
            ScanNow = false;
            bool isVerifyTicketSuccess = false;

            try
            {
                var ticket = VerifyTicketByTicketNo(no, out isVerifyTicketSuccess);
                if (ticket == null)
                {
                    //扫码失败
                    LoadChkFail_Scan(ticket.Error, true);
                }
                else
                {
                    if (isVerifyTicketSuccess)
                    {
                        //扫码成功
                        LoadCRAS(true);
                        lbl_autsc_TckName.Text  = ticket.TicketTypeName;                                                                                       //票种名称
                        lbl_autsc_TckProp.Text  = ticket.TicketMode;                                                                                           //票种属性
                        lbl_autsc_Name.Text     = ticket.VisitorName;                                                                                          //游客姓名
                        lbl_autsc_ID.Text       = ticket.IdCardNo;                                                                                             //身份证号码
                        lbl_autsc_OutWay.Text   = ticket.PeopleNum > 1 ? "一票多人" : "一票一人";                                                                      //出票方式
                        lbl_autsc_Num.Text      = ticket.PeopleNum.ToString();                                                                                 //通行人数
                        lbl_autsc_UseDate.Text  = ticket.TicketStartTime.Date.ToString("yyyy-MM-dd") + "~" + ticket.TicketEndTime.Date.ToString("yyyy-MM-dd"); //检票有效期
                        lbl_autsc_PlayDate.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");                                                                    //游玩时间
                    }
                    else
                    {
                        //扫码失败
                        LoadChkFail_Scan(ticket.Error, true);
                    }
                    if (!string.IsNullOrEmpty(ticket.Music))
                    {
                        SoundHelper.Play(ticket.Music);
                    }
                }
                return(ticket);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误");
                return(null);
            }
            finally
            {
                ScanNow = true;
            }
        }
예제 #7
0
 /// <summary>
 /// 人工验票失败验票
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void picDo3_Click(object sender, EventArgs e)
 {
     try
     {
         picDo3.Enabled = false;
         bool isVerifyTicketSuccess = false;
         var  entin = txtChk3.Text.Trim();
         if (string.IsNullOrEmpty(entin))
         {
             MessageBox.Show("票号不可为空!", "提示");
         }
         var ticket = VerifyTicketByTicketNo(entin, out isVerifyTicketSuccess);
         if (ticket == null)
         {
             //人工验票失败
             LoadChkFail_Manul(ticket.Error, true);
         }
         else
         {
             if (isVerifyTicketSuccess)
             {
                 //人工验票成功
                 LoadCRES(true);
                 lbl_hndsc_TckName.Text  = ticket.TicketTypeName;                                                                                       //票种名称
                 lbl_hndsc_TckProp.Text  = ticket.TicketMode;                                                                                           //票种属性
                 lbl_hndsc_OutWay.Text   = ticket.PeopleNum > 1 ? "一票多人" : "一票一人";                                                                      //出票方式
                 lbl_hndsc_Num.Text      = ticket.PeopleNum.ToString();                                                                                 //通行人数
                 lbl_hndsc_UseDate.Text  = ticket.TicketStartTime.Date.ToString("yyyy-MM-dd") + "~" + ticket.TicketEndTime.Date.ToString("yyyy-MM-dd"); //检票有效期
                 lbl_hndsc_PlayDate.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");                                                                    //游玩时间
             }
             else
             {
                 //人工验票失败
                 LoadChkFail_Manul(ticket.Error, true);
             }
             if (!string.IsNullOrEmpty(ticket.Music))
             {
                 SoundHelper.Play(ticket.Music);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "错误");
     }
     finally
     {
         picDo3.Enabled = true;
     }
 }
예제 #8
0
    void Start()
    {
        _pads = FindObjectsOfType <PadBehaviour>();

        _ball = FindObjectOfType <BallBehaviour>();
        _ball.Initiate();

        _textsScore = FindObjectsOfType <Text>();

        GameContainer = new GameInfoContainer();

        SoundHelper.Load();
        SoundHelper.Play(SoundHelper.Audios.Beep);
    }
예제 #9
0
    //
    // Click for pressDuration seconds
    //  a good visual pressDuration is 0.33f
    public virtual void Click(float pressDuration = 0)
    {
        if (!(isActiveAndEnabled && Interactable))
        {
            // button must be active and interactable to click
            return;
        }

        // show button as pressed
        _showAsPressed = true;
        UpdateButton();

        void unpressCallback()
        {
            //
            // invoke and unpress button

            onClickEvent?.Invoke(this);

            // SkipPointerUp skips returning to the normal ("Up") state after
            //  clicking, which is useful with tab menus or button toggles,
            //  otherwise you see the normal state flicker.
            _showAsPressed = SkipPointerUp;
            UpdateButton();
        }

        if (waitForClickSound && pressDuration == 0 && Enabled)
        {
            SoundHelper.Play(clickSound, unpressCallback);
        }
        else
        {
            if (clickSound && Enabled)
            {
                clickSound?.Play();
            }
            if (pressDuration > 0)
            {
                Delayer.Delay(pressDuration, unpressCallback);
            }
            else
            {
                unpressCallback();
            }
        }
    }
예제 #10
0
    public void moveTowardsTarget(HexaPos _targetPos)
    {
        for (int i = 0; i < walkRange; i++)
        {
            int dist = Map.distance(pos, _targetPos);

            if (dist <= 0)
            {
                break;
            }

            int     dir        = Map.getDirection(pos, _targetPos);
            HexaPos moveTarget = Map.tilesInRange(pos, 1)[dir];
            SceneHandler.setMeeplePos(this.gameObject, moveTarget);
            Debug.Log(meepleName + "moved!!!to" + moveTarget + "DIRECTION:");
        }

        GameObject  tileHolder = GameObject.Find("tileHolder");
        SoundHelper sh         = tileHolder.GetComponent <SoundHelper>();

        sh.Play("run");
    }
예제 #11
0
    public static void endTurn(bool _moved)
    {
        if (turn > 0)
        {
            Debug.Log("The turn ended. Did the Caravan moved? " + _moved);
            GameObject  tileHolder = GameObject.Find("tileHolder");
            SoundHelper sh         = tileHolder.GetComponent <SoundHelper>();
            if (_moved)
            {
                sh.Play("move");
                consumeProviant(getFoodUptake());
            }
            else
            {
                sh.Play("rest");
                consumeProviant(getFoodUptake());
            }

            List <PackAnimal> packAnimals = getAllMeeplesFromType <PackAnimal>();
            foreach (PackAnimal packAnimal in packAnimals)
            {
                if (!packAnimal.isGuided())
                {
                    meeples.Remove(packAnimal);
                    GameObject tmp = packAnimal.gameObject.transform.parent.gameObject;
                    Destroy(tmp);
                    sh.Play("leftBehind");
                }
            }

            List <Companion> comps  = getAllMeeplesFromType <Companion>();
            List <Prince>    prince = getAllMeeplesFromType <Prince>();
            if (comps.Count <= 0 || prince.Count <= 0)
            {
                endGame(comps);
            }
            Map.highlightAllInnerTiles(false);

            foreach (Companion comp in comps)
            {
                comp.HasActionOutstanding = true;
            }

            tileType lTileType = largeMap[caravanPosition.x, caravanPosition.y].GetComponent <Tile>().tile_type;

            if (lTileType == tileType.Forrest)
            {
                List <Hunter> hunter = getAllMeeplesFromType <Hunter>();
                if (hunter.Count > 0)
                {
                    activeTacticalGame = new HuntingGround(rand.Next(0, 6), 2);
                    activeTacticalGame.init();
                    activeTacticalGame.run();
                }
            }
            else if (lTileType == tileType.Oasis)
            {
                foreach (Companion comp in comps)
                {
                    comp.Strength += 5;
                }
            }
            else
            {
                int rndEnemySpawn = rand.Next(0, 15);
                if (rndEnemySpawn < 4)
                {
                    List <Mercenary> mercs = getAllMeeplesFromType <Mercenary>();
                    if (mercs.Count > 0)
                    {
                        activeTacticalGame = new BattleGround(rand.Next(0, 6));
                        activeTacticalGame.init();
                        activeTacticalGame.run();
                    }
                    else
                    {
                        endGame(comps);
                    }
                }
            }
        }
        turn++;
    }
예제 #12
0
 public static void PlayCheckmate(Callback callback = default)
 {
     SoundHelper.Play(Checkmate, callback);
 }
예제 #13
0
    public static T createMeeple <T>(string _name, HexaPos _hexPos, bool _neutral = false) where T : Meeple
    {
        GameObject meepleObj = null;

        switch (typeof(T).ToString())
        {
        case "Mercenary":
            meepleObj = (GameObject)Instantiate(Initialisation.soldier);
            break;

        case "Hunter":
            meepleObj = (GameObject)Instantiate(Initialisation.worker);
            break;

        case "Prince":
            meepleObj = (GameObject)Instantiate(Initialisation.king);
            break;

        case "HuntedAnimal":
            meepleObj = (GameObject)Instantiate(Initialisation.antilope);
            break;

        case "Opponent":
            meepleObj = (GameObject)Instantiate(Initialisation.raider);
            break;

        case "Healer":
            meepleObj = (GameObject)Instantiate(Initialisation.healer);
            break;

        case "Scout":
            meepleObj = (GameObject)Instantiate(Initialisation.scout);
            break;

        case "PackAnimal":
            meepleObj = (GameObject)Instantiate(Initialisation.camel);
            break;

        default:
            return(null);
        }

        Meeple meeple = meepleObj.AddComponent <T>();

        meepleObj.name = _name;
        Vector3 scaleSave = meeple.transform.localScale;
        Vector3 posSave   = meeple.transform.localPosition;

        meeple.Pos        = _hexPos;
        meeple.meepleName = _name;

        positionAndParent_Meeple(meepleObj, _hexPos);
        meeple.transform.localScale    = scaleSave;
        meeple.transform.localPosition = posSave;

        GameObject  tileHolder = GameObject.Find("tileHolder");
        SoundHelper sh         = tileHolder.GetComponent <SoundHelper>();

        sh.Play("spawn");

        if (!_neutral)
        {
            meeples.Add(meeple);
        }

        highlightUnguidedPackAnimals();

        return((T)meeple);
    }
예제 #14
0
 public static void PlayPromote(Callback callback = default)
 {
     SoundHelper.Play(Promote, callback);
 }
예제 #15
0
 public static void PlayStalemate(Callback callback = default)
 {
     SoundHelper.Play(Stalemate, callback);
 }
예제 #16
0
 public static void PlayUndo(Callback callback = default)
 {
     SoundHelper.Play(Undo, callback);
 }
예제 #17
0
 public static void PlayCapture(Callback callback = default)
 {
     SoundHelper.Play(Capture, callback);
 }
예제 #18
0
 public static void PlayEnPassant(Callback callback = default)
 {
     SoundHelper.Play(EnPassant, callback);
 }
예제 #19
0
 /// <summary>
 /// Plays a sound at the camera's position
 /// </summary>
 /// <param name="audioClip"></param>
 public static void PlaySound(AudioClip audioClip) => SoundHelper.Play(audioClip);
예제 #20
0
 public static void PlayJump(Callback callback = default)
 {
     SoundHelper.Play(Jump, callback);
 }
예제 #21
0
 public static void PlayLeap(Callback callback = default)
 {
     SoundHelper.Play(Leap, callback);
 }
예제 #22
0
 public static void PlayPin(Callback callback = default)
 {
     SoundHelper.Play(Pin, callback);
 }
예제 #23
0
 /// <summary>
 /// Plays a sound at a position
 /// </summary>
 /// <param name="audioClip"></param>
 /// <param name="position"></param>
 public static void PlaySound(AudioClip audioClip, Vector2 position) => SoundHelper.Play(audioClip, position);
예제 #24
0
 private void BtnMute_Click(object sender, RoutedEventArgs e)
 {
     SoundHelper.IsSoundOn = !SoundHelper.IsSoundOn;
     ChangedSoundIcon();
     SoundHelper.Play(_gameState);
 }
예제 #25
0
 public static void PlayExchange(Callback callback = default)
 {
     SoundHelper.Play(Exchange, callback);
 }
예제 #26
0
    public void activateCompanion(bool _respectWalkRange = true)
    {
        SceneHandler.activeCompanion = this;


        Debug.Log("actION" + hasActionOutstanding);
        if (hasActionOutstanding)
        {
            if (_respectWalkRange)
            {
                List <HexaPos> walkableTilesPos = new List <HexaPos>();
                walkableTilesPos = Map.tilesInRange(Pos, walkRange);

                Map.highlightAllInnerTiles(false);
                foreach (HexaPos tilePos in walkableTilesPos)
                {
                    try
                    {
                        SceneHandler.smallMap[tilePos.x, tilePos.y].GetComponent <innerTile>().setHighlighted(true);
                    }
                    catch (Exception) {}
                }

                List <Opponent> opps = SceneHandler.getAllMeeplesFromType <Opponent>();
                foreach (Opponent opp in opps)
                {
                    SceneHandler.smallMap[opp.Pos.x, opp.Pos.y].GetComponent <innerTile>().setHighlighted(true);
                }
            }
            else
            {
                Map.highlightAllInnerTiles(true);
                List <Companion> comps = SceneHandler.getAllMeeplesFromType <Companion>();

                List <HexaPos> negatiabletiles = new List <HexaPos>();

                foreach (Companion comp in comps)
                {
                    if (comp != SceneHandler.activeCompanion)
                    {
                        if (comp.GetType() == typeof(Prince))
                        {
                            if (SceneHandler.activeCompanion.GetType() == typeof(Hunter))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2));
                            }
                            else if (SceneHandler.activeCompanion.GetType() == typeof(PackAnimal))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2));
                            }
                            else if (SceneHandler.activeCompanion.GetType() == typeof(Healer))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1));
                            }
                            else if (SceneHandler.activeCompanion.GetType() == typeof(Mercenary))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1));
                            }
                            else if (SceneHandler.activeCompanion.GetType() == typeof(Scout))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1));
                            }
                        }
                        else if (comp.GetType() == typeof(Hunter))
                        {
                            if (SceneHandler.activeCompanion.GetType() == typeof(Prince))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2));
                            }
                        }
                        else if (comp.GetType() == typeof(PackAnimal))
                        {
                            if (SceneHandler.activeCompanion.GetType() == typeof(Prince))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 2));
                            }
                        }
                        else if (comp.GetType() == typeof(Mercenary))
                        {
                            if (SceneHandler.activeCompanion.GetType() == typeof(Prince))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1));
                            }
                        }
                        else if (comp.GetType() == typeof(Healer))
                        {
                            if (SceneHandler.activeCompanion.GetType() == typeof(Prince))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1));
                            }
                        }
                        else if (comp.GetType() == typeof(Scout))
                        {
                            if (SceneHandler.activeCompanion.GetType() == typeof(Prince))
                            {
                                negatiabletiles.AddRange(Map.tilesInRange(new HexaPos(comp.Pos.x, comp.Pos.y), 1));
                            }
                        }
                    }
                }

                foreach (HexaPos negPos in negatiabletiles)
                {
                    try
                    {
                        innerTile negTile = SceneHandler.smallMap[negPos.x, negPos.y].GetComponent <innerTile>();
                        negTile.setHighlighted(false);
                    }catch (Exception e) {}
                }
            }

            MeshRenderer innerTMesh = SceneHandler.smallMap[Pos.x, Pos.y].GetComponent <MeshRenderer>();
            innerTMesh.material = Initialisation.lookOutMate;

            SceneHandler.highlightUnguidedPackAnimals();

            GameObject  tileHolder = GameObject.Find("tileHolder");
            SoundHelper sh         = tileHolder.GetComponent <SoundHelper>();
            sh.Play("selected");
        }
    }
예제 #27
0
 public static void PlayPass(Callback callback = default)
 {
     SoundHelper.Play(Pass, callback);
 }
예제 #28
0
 public static void PlayStart(Callback callback = default)
 {
     SoundHelper.Play(Start, callback);
 }
예제 #29
0
    void OnMouseDown()
    {
        if (isActive)
        {
            Map.highlightAllInnerTiles(false);

            if (meep == null && SceneHandler.meeples.Contains(SceneHandler.activeCompanion))
            {
                SceneHandler.setMeeplePos(SceneHandler.activeCompanion.gameObject, new HexaPos(posX, posY));

                GameObject  tileHolder = GameObject.Find("tileHolder");
                SoundHelper sh         = tileHolder.GetComponent <SoundHelper>();
                sh.Play("run");
            }
            else if (meep == null && SceneHandler.activeMode == GameMode.PREPARATION)
            {
                Type compType = SceneHandler.activeCompanion.GetType();

                switch (compType.ToString())
                {
                case "Mercenary":
                    SceneHandler.createMeeple <Mercenary>("Mercenary", new HexaPos(posX, posY));
                    break;

                case "Hunter":
                    SceneHandler.createMeeple <Hunter>("Mercenary", new HexaPos(posX, posY));
                    break;

                case "HuntedAnimal":
                    SceneHandler.createMeeple <HuntedAnimal>("Mercenary", new HexaPos(posX, posY));
                    break;

                case "Healer":
                    SceneHandler.createMeeple <Healer>("Mercenary", new HexaPos(posX, posY));
                    break;

                case "Scout":
                    SceneHandler.createMeeple <Scout>("Mercenary", new HexaPos(posX, posY));
                    break;

                case "PackAnimal":
                    SceneHandler.createMeeple <PackAnimal>("Mercenary", new HexaPos(posX, posY));
                    break;

                default:
                    break;
                }
            }
            else if (meep.GetType() == typeof(Opponent) && SceneHandler.activeTacticalGame.GetType() == typeof(BattleGround))
            {
                Mercenary merc = (Mercenary)SceneHandler.activeCompanion;

                int dist = Map.distance(meep.Pos, merc.Pos);
                int rnd  = SceneHandler.rollDice(10);
                Debug.Log(rnd + " " + dist);
                if (rnd >= dist)
                {
                    merc.fight(meep.GetComponent <Opponent>());
                }
                merc.HasActionOutstanding = false;
            }
            else if (meep.GetType() == typeof(HuntedAnimal) && SceneHandler.activeTacticalGame.GetType() == typeof(HuntingGround))
            {
                Debug.Log("HUNT");
                Hunter hunter = (Hunter)SceneHandler.activeCompanion;
                SceneHandler.gainProviant(hunter.hunt(meep.GetComponent <HuntedAnimal>()));
            }

            SceneHandler.activeCompanion = null;
        }
    }
예제 #30
0
        /// <summary>
        /// 根据输入字符串选择市民卡或检票
        /// </summary>
        /// <param name="no"></param>
        /// <returns></returns>
        private TicketInfo Check(string no)
        {
            Tmr_Count_Dispose();

            try
            {
                if (!string.IsNullOrEmpty(no) && no.Length > 50)
                {
                    CheckCityCard(no);
                    return(new TicketInfo());
                }

                bool isVerifyTicketSuccess = false;
                var  ticket = VerifyTicketByTicketNo(no, out isVerifyTicketSuccess);
                if (ticket == null)
                {
                    lbl_TicketNo_Invalid.Text = no;
                    pnl_General.Visible       = true;
                    pnl_Valid.Visible         = false;
                    pnl_Invalid.Visible       = false;
                    pic_Invalid.Image         = null;
                }
                else
                {
                    if (isVerifyTicketSuccess)
                    {
                        lbl_TicketNo.Text         = ticket.TicketNo;
                        lbl_TicketName.Text       = ticket.Name;
                        lbl_TickType.Text         = ticket.TicketType;
                        lbl_TicketNumber.Text     = ticket.Number;
                        lbl_TicketSellTime.Text   = ticket.SellTime;
                        lbl_TicketPrice.Text      = ticket.Price;
                        lbl_TicketValid.Text      = "有效";
                        lbl_TicketVerifyTime.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                        lbl_TicketVerifyGate.Text = Config.GateName;

                        pnl_General.Visible = false;
                        pnl_Valid.Visible   = true;
                        pnl_Invalid.Visible = false;

                        TicketCount++;
                        lbl_HasCount.Text = TicketCount.ToString();
                    }
                    else
                    {
                        lbl_TicketNo_Invalid.Text = no;
                        pnl_General.Visible       = false;
                        pnl_Valid.Visible         = false;
                        pnl_Invalid.Visible       = true;
                        pic_Invalid.Image         = ticket.ShowImg;
                    }
                    pic_Invalid.Refresh();
                    if (!string.IsNullOrEmpty(ticket.Music))
                    {
                        SoundHelper.Play(ticket.Music);
                    }
                }
                Tmr_Count.Enabled = true;
                return(ticket);
            }
            catch (Exception ex)
            {
                MessageBox.Show("连接失败,可能网络异常\r\n或服务未启动,请稍后再试!", "网络异常");
                return(null);
            }
        }