コード例 #1
0
ファイル: Program.cs プロジェクト: kimbokChi/Kimbokchi
        static void Main(string[] args)
        {
            // 60% : 0,
            // 30% : 1,
            //  5% : 2,
            //  3% : 3,
            //  2% : 4
            float[] probabilities = new float[5] {
                0.6f, 0.3f, 0.05f, 0.03f, 0.02f
            };

            var luckyBox = new LuckyBox <Items>();

            luckyBox.AddItem(0.6f, Items.Iron, Items.Iron, Items.Iron, Items.Iron, Items.Iron);
            luckyBox.AddItem(0.3f, Items.Bronze, Items.Bronze, Items.Bronze, Items.Bronze);
            luckyBox.AddItem(0.05f, Items.Sliver, Items.Sliver, Items.Sliver);
            luckyBox.AddItem(0.03f, Items.Gold, Items.Gold);
            luckyBox.AddItem(0.02f, Items.Diamond);

            for (int i = 0; i < 30; i++)
            {
                Console.WriteLine(luckyBox.RandomItem().ToString());

                if (i == 14)
                {
                    Console.WriteLine("");
                }
            }
            Console.ReadLine();
        }
コード例 #2
0
    public IEnumerator WaitAndResult(LuckyBox _luckyBox, Player target)
    {
        // ���� ���� ���
        while (!isEnd)
        {
            //Debug.LogWarning("��Ű �ڽ� :: ���� ���� �����");
            yield return(null);
        }

        //

        // ����� ���
        MessageBox mb = GameData.gameMaster.messageBox;

        //mb.PopUp(mb.pageSwitch.GetObject(3).GetComponent<UnityEngine.UI.MessageBox.MessageBoxRule>(), 3);     // ��Ű�ڽ� Ÿ���� ���� 3�� ====== ���� ���������� �����Ұ�
        mb.PopUp(MessageBox.Type.LuckyBox);


        // �޽��� �ڽ� Ȯ�� ���
        while (mb.gameObject.activeSelf)
        {
            //Debug.LogWarning("��Ű �ڽ� :: �޽��� �ڽ� Ȯ�� �����");
            yield return(null);
        }

        // �����
        Hide();

        // ȿ�� ����
        yield return(_luckyBox.Effect(target));

        Debug.LogError("Lucky Box :: ȿ�� ����� = " + _luckyBox.name);

        // �̵� ���� ���
        while (target.movement.actNow.type != Action.ActionType.None || target.movement.actionsQueue.Count > 0)
        {
            yield return(null);
        }

        // ���� ����
        BlockWork.isEnd = true;

        // �ʱ�ȭ ����
        ClearForced();
    }
コード例 #3
0
    void Work_Title()
    {
        // �۾� ��ǥ�� ����
        workMax = 10000;

        gameObject.SetActive(false);
        workCount++;

        // ���� �÷ο� ����
        GameData.gameFlow = GameMaster.Flow.Wait;


        // ���� ������ �ε�
        // = �� ���еǴ� ��ⵥ���Ͱ��/User/UserData.iocdata ������ ���纻(true)���� ���� ����(false)�ϰ� �о��
        UserData.file = new CSVReader("User", "UserData.iocdata", true, false, '=');
        UserData.SetUp();
        workCount += UserData.file.table.Count;

        // ij���� ���̺�
        Character.SetUp();
        workCount += Character.table.Count;

        // ������ ���̺�
        Item.SetUp();
        workCount += Item.table.Count;

        // �̺�Ʈ ���̺�
        IocEvent.SetUp();
        workCount += IocEvent.table.Count;

        // ��Ű�ڽ� ���̺�
        LuckyBox.SetUp();
        workCount += LuckyBox.table.Count;

        // ����ũ ���̺�
        Unique.SetUp();
        workCount += Unique.table.Count;
    }
コード例 #4
0
ファイル: Event.cs プロジェクト: RedTheKitsune/NFSWGameplay
 // Token: 0x06001702 RID: 5890 RVA: 0x000286EC File Offset: 0x000276EC
 internal virtual void StoreAccolades(Victory.DataLayer.Serialization.Event.Accolades accolades)
 {
     this.accolades = new Interop.Accolades();
     if (accolades.FinalRewards != null)
     {
         this.accolades.Reputation = accolades.FinalRewards.Rep;
         this.accolades.Tokens     = accolades.FinalRewards.Tokens;
     }
     if (accolades.OriginalRewards != null)
     {
         this.accolades.OriginalReputation = accolades.OriginalRewards.Rep;
         this.accolades.OriginalTokens     = accolades.OriginalRewards.Tokens;
     }
     this.accolades.HasLeveledUp = accolades.HasLeveledUp;
     if (accolades.LuckyDrawInfo != null)
     {
         LuckyDraw luckyDraw = this.accolades.GetLuckyDraw();
         luckyDraw.HasLuckyDraw = (accolades.LuckyDrawInfo.Items != null && accolades.LuckyDrawInfo.Items.Count > 0);
         luckyDraw.SetCardDeck(accolades.LuckyDrawInfo.CardDeck);
         luckyDraw.NumCards         = accolades.LuckyDrawInfo.NumCards;
         luckyDraw.NumBoxAnimations = accolades.LuckyDrawInfo.NumBoxAnimations;
         luckyDraw.CurrentStreak    = accolades.LuckyDrawInfo.CurrentStreak;
         luckyDraw.IsStreakBroken   = accolades.LuckyDrawInfo.IsStreakBroken;
         if (accolades.LuckyDrawInfo.Items != null)
         {
             foreach (LuckyDrawItem luckyDrawItem in accolades.LuckyDrawInfo.Items)
             {
                 LuckyItem luckyItem = new LuckyItem();
                 luckyItem.SetVirtualItem(luckyDrawItem.VirtualItem);
                 luckyItem.SetCategory(luckyDrawItem.VirtualItemType);
                 luckyItem.SetDescription(luckyDrawItem.Description);
                 luckyItem.SetIcon(luckyDrawItem.Icon);
                 luckyItem.Value    = luckyDrawItem.RemainingUseCount;
                 luckyItem.Price    = luckyDrawItem.ResellPrice;
                 luckyItem.ItemType = Inventory.GetProductTypeFromString(luckyDrawItem.VirtualItemType);
                 luckyItem.WasSold  = luckyDrawItem.WasSold;
                 luckyItem.PartID   = luckyDrawItem.Hash;
                 luckyDraw.AddItems(luckyItem);
             }
         }
         if (accolades.LuckyDrawInfo.Boxes != null)
         {
             foreach (LuckyDrawBox luckyDrawBox in accolades.LuckyDrawInfo.Boxes)
             {
                 LuckyBox luckyBox = new LuckyBox();
                 luckyBox.IsValid    = luckyDrawBox.IsValid;
                 luckyBox.CategoryId = (LuckyBoxCategory)luckyDrawBox.LuckyDrawSetCategoryId;
                 luckyBox.SetCategoryName(luckyDrawBox.LocalizationString);
                 luckyDraw.AddBoxes(luckyBox);
             }
         }
     }
     if (accolades.RewardInfo != null)
     {
         foreach (Victory.DataLayer.Serialization.Event.RewardPart rewardPart in accolades.RewardInfo)
         {
             Interop.RewardPart rewardPart2 = new Interop.RewardPart();
             rewardPart2.SetCategory(rewardPart.RewardCategory.ToString());
             if (rewardPart.RepPart != 0)
             {
                 rewardPart2.SetName(string.Format("REWARD_TYPE_{0}_REP", rewardPart.RewardType.ToString()));
                 rewardPart2.SetType("rep");
                 rewardPart2.Value = rewardPart.RepPart;
                 this.accolades.AddRewardParts(rewardPart2);
             }
             if (rewardPart.TokenPart != 0)
             {
                 rewardPart2.SetName(string.Format("REWARD_TYPE_{0}_TOKEN", rewardPart.RewardType.ToString()));
                 rewardPart2.SetType("tokens");
                 rewardPart2.Value = rewardPart.TokenPart;
                 this.accolades.AddRewardParts(rewardPart2);
             }
         }
     }
     this.ScoringMethod.AccoladesFetched(this.accolades);
 }
コード例 #5
0
    /// <summary>
    /// 럭키박스 효과
    /// </summary>
    /// <param name="__luckyBox"></param>
    /// <param name="user">작동자</param>
    /// <param name="filteredTarget">효과 대상</param>
    /// <returns></returns>
    public static IEnumerator EachEffect(LuckyBox __luckyBox, Player user, List <Player> filteredTarget)
    {
        switch (__luckyBox.index)
        {
        // 필요시 추가

        case 0:
            // 0번은 없음
            break;

        case 16:
            // 선인장 도적단
        {
            // 잘못된 인원수 차단
            if (filteredTarget.Count == 0)
            {
                break;
            }

            // 연출
            // 미구현=============

            ItemSlot slot = null;
            for (int i = 0; i < filteredTarget.Count; i++)
            {
                // 아이템 없으면 중단
                if (filteredTarget[i].inventoryCount <= 0)
                {
                    break;
                }

                // 가져올 아이템 지정
                slot = filteredTarget[i].inventory[0];

                // 강탈
                filteredTarget[i].RemoveItem(slot);
            }
        }

        break;

        case 17:
            // 중립 몬스터 돌격
        {
            // 돌진 명령 - 자동화
            yield return(MonsterManager.script.Dash(user.location, __luckyBox.effect.where));

            // 수동화 - 사용 안함
            {
                //// 소환
                //MonsterManager.script.Call(user.location);

                //// 애니메이션 작동
                //MonsterManager.script.Work();

                //// 카메라 포커싱
                //MonsterManager.script.Focus();

                //// 돌진 명령
                //yield return MonsterManager.script.DashOnly(__luckyBox.effect.where);

                //// 몬스터 숨김
                //MonsterManager.script.Hide();
            }


            // 구 코드 - 폐기 예정
            {
                /*
                 *
                 * // 생성 위치
                 * int blockIndex = 0;
                 *
                 * // 플레이어 지정시 위치 확보
                 * if (user != null)
                 *  blockIndex = user.location;
                 *
                 *
                 *
                 * // 제어자 퀵등록
                 * Player world = Player.system.World;
                 *
                 * // 백업
                 * GameObject backAvatar = world.avatar;
                 * Transform backAvatarBody = world.avatarBody;
                 * //CharacterMover backMovement = avatar.movement;
                 *
                 * // 생성할 몬스터
                 * // 미구현==================== 프리팹 지정할것
                 * GameObject obj = null;
                 *
                 * // 생성 및 등록=================프리팹 지정 안되어서 널 오류 발생
                 * world.avatar = GameObject.Instantiate(
                 *  obj,
                 *  BlockManager.script.startBlock
                 *  ) as GameObject;
                 * world.avatarBody = world.avatar.transform.Find("BodyObject");
                 *
                 * // 이동제어 셋업
                 * CharacterMover movement = world.avatar.GetComponent<CharacterMover>();
                 * movement.owner = world;
                 *
                 * // 퀵등록
                 * Transform monster = world.avatar.transform;
                 *
                 * // 초기위치 설정
                 * if (user.location != -1)
                 *  movement.location = user.location;
                 *
                 * // 위치 적용
                 * monster.position = user.avatar.transform.position;
                 *
                 *
                 * // 카메라 부착
                 * GameData.worldManager.cameraManager.CamMoveTo(monster, CameraManager.CamAngle.Top);
                 *
                 * // 돌진 계획
                 * movement.PlanMoveBy(__luckyBox.effect.where);
                 *
                 *
                 * // 잔여 액션 있음 or 액션 수행중 경우
                 * while (movement.actionsQueue.Count > 0 || movement.actNow.type == Action.ActionType.None)
                 * {
                 *  movement.ActionCall();
                 * }
                 *
                 *
                 *
                 *
                 * // 복구
                 * world.avatar = backAvatar;
                 * world.avatarBody = backAvatarBody;
                 *
                 * // 할당 해제
                 * movement = null;
                 *
                 * // 몬스터 제거
                 * Transform.Destroy(monster);
                 *
                 */
            }

            // 카메라 탈착
            GameData.worldManager.cameraManager.CamMoveTo(Turn.now.avatar.transform, CameraManager.CamAngle.Top);
            //GameData.worldManager.cameraManager.CamFree();
        }
        break;

        case 20:
            // 럭키 아이템
        {
            // 럭키박스 드랍테이블
            DropTable dropTable = new DropTable();

            // 드랍테이블 셋팅
            dropTable.rare = new List <int>();
            for (int i = 0; i < Item.tableLuckyDrop.Count; i++)
            {
                dropTable.rare.Add(Item.tableLuckyDrop[i].rare);
                Debug.Log("드랍 테이블 :: 추가됨 -> " + Item.tableLuckyDrop[i].rare);
            }
            Debug.LogWarning("드랍 테이블 :: 목록 총량 ->" + dropTable.rare.Count);

            int select = dropTable.Drop();
            Debug.LogWarning("럭키 아이템 :: 선택됨 -> " + Item.tableLuckyDrop[select].name);

            // 지급
            user.AddItem(Item.tableLuckyDrop[select], 1);
        }
        break;

        case 21:
            // 공공의 적
        {
            // 코인 최다 플레이어
            List <Player> best    = new List <Player>();
            Player        current = null;

            for (int i = 0; i < user.otherPlayers.Count; i++)
            {
                current = user.otherPlayers[i];

                // 비교대상 없을 경우 즉시 지정
                if (best.Count == 0)
                {
                    best.Add(current);
                }

                // 코인 더 많을 경우 지정
                else if (current.coin.Value > best[0].coin.Value)
                {
                    best.Clear();
                    best.Add(current);
                }

                // 같을 경우
                else if (current.coin.Value == best[0].coin.Value)
                {
                    best.Add(current);
                }
            }

            // 코인 강탈
            for (int i = 0; i < best.Count; i++)
            {
                best[i].coin.subtract(__luckyBox.effect.value / best.Count);
            }

            // 코인 지급
            user.coin.Add(__luckyBox.effect.value);
        }
        break;

        case 22:
            // 코인 최다 플레이어
        {
            List <Player> least   = new List <Player>();
            Player        current = null;

            for (int i = 0; i < user.otherPlayers.Count; i++)
            {
                current = user.otherPlayers[i];

                // 비교대상 없을 경우 즉시 지정
                if (least.Count == 0)
                {
                    least.Add(current);
                }

                // 코인 더 적을 경우 지정
                else if (current.coin.Value < least[0].coin.Value)
                {
                    least.Clear();
                    least.Add(current);
                }

                // 같을 경우
                else if (current.coin.Value == least[0].coin.Value)
                {
                    least.Add(current);
                }
            }

            // 코인 강탈
            user.coin.subtract(__luckyBox.effect.value);

            // 코인 지급
            for (int i = 0; i < least.Count; i++)
            {
                least[i].coin.Add(__luckyBox.effect.value / least.Count);
            }
        }
        break;
        }

        yield return(null);
    }