コード例 #1
0
ファイル: CharaTable.cs プロジェクト: lillianwang16/Games
    // Token: 0x06000262 RID: 610 RVA: 0x00007E94 File Offset: 0x00006294
    public void selectedItem(int charaId, int itemId)
    {
        if (itemId == -1)
        {
            this.ResetFocus();
            return;
        }
        int index = this.RefChara.FindIndex((GameObject rec) => rec.GetComponent <CharaObject>().charaId.Equals(charaId));
        EventTimerFormat eventTimerFormat = SuperGameMaster.evtMgr.get_ActEvt_forId(this.RefActEvtId[index]);
        ItemDataFormat   itemDataFormat   = new ItemDataFormat();

        itemDataFormat = SuperGameMaster.sDataBase.get_ItemDB_forId(itemId);
        bool flag = false;

        for (int i = 0; i < itemDataFormat.effectType.Length; i++)
        {
            if (itemDataFormat.effectElm[i] == EffectElm.FL_RARE)
            {
                flag = true;
            }
        }
        int num  = UnityEngine.Random.Range(0, 100);
        int num2 = 0;

        Define.Gift gift = Define.Gift.NONE;
        for (int j = 0; j < 3; j++)
        {
            if (flag)
            {
                num2 += Define.FRIEND_GIFTPER_RARE[(Define.Gift)j];
            }
            else
            {
                num2 += Define.FRIEND_GIFTPER_NORMAL[(Define.Gift)j];
            }
            if (num < num2)
            {
                gift = (Define.Gift)j;
                break;
            }
        }
        CharacterDataFormat characterDataFormat = SuperGameMaster.sDataBase.get_CharaDB_forId(charaId);
        int num3 = Define.FRIEND_GIFTFIX[gift];

        if (gift != Define.Gift.Clover)
        {
            if (gift != Define.Gift.FourClover)
            {
                if (gift == Define.Gift.Ticket)
                {
                    if (flag)
                    {
                        num3 += UnityEngine.Random.Range(1, 4);
                    }
                }
            }
        }
        else
        {
            int   num4 = SuperGameMaster.sDataBase.get_CharaDB_rowItemId_index(itemId);
            float num5 = (100f + (float)characterDataFormat.taste[num4]) / 100f;
            float num6 = (float)(eventTimerFormat.activeTime / 1800);
            int   num7 = new List <int>
            {
                eventTimerFormat.evtValue[2],
                eventTimerFormat.evtValue[3],
                eventTimerFormat.evtValue[4]
            }.FindIndex((int rec) => rec.Equals(itemId));
            float num8 = 1f;
            if (num7 != -1)
            {
                num8 = Define.FRIEND_ITEM_DEBUFF[num7];
            }
            num3 += (int)((float)characterDataFormat.cloverPow * num5 * num6 * num8 / 15f);
            Debug.Log(string.Concat(new object[]
            {
                "みつば数算出:[",
                num3,
                "] pow = ",
                characterDataFormat.cloverPow,
                " / taste = ",
                num5,
                " / count = ",
                num6,
                " / buf = ",
                num8
            }));
            if (flag)
            {
                num3 += 20;
            }
        }
        Debug.Log(string.Concat(new object[]
        {
            "[CharaTable] お返しの抽選を行ないました: charaId = ",
            charaId,
            " / itemId = ",
            itemId,
            "(",
            flag,
            ") >> ",
            gift.ToString(),
            "(",
            num3,
            ")"
        }));
        List <int> list = new List <int>();

        list.Add(eventTimerFormat.evtValue[0]);
        list.Add(1);
        list.Add(itemId);
        list.Add(eventTimerFormat.evtValue[2]);
        list.Add(eventTimerFormat.evtValue[3]);
        list.Add(eventTimerFormat.evtValue[5]);
        SuperGameMaster.evtMgr.set_ActEvt_forId(eventTimerFormat.id, list);
        EventTimerFormat eventTimerFormat2 = new EventTimerFormat();

        eventTimerFormat2.id          = -1;
        eventTimerFormat2.timeSpanSec = eventTimerFormat.timeSpanSec;
        eventTimerFormat2.activeTime  = -1;
        eventTimerFormat2.addTime     = new DateTime(1970, 1, 1);
        eventTimerFormat2.evtType     = TimerEvent.Type.Gift;
        eventTimerFormat2.evtId       = charaId;
        eventTimerFormat2.evtValue    = new List <int>();
        eventTimerFormat2.evtValue.Add((int)gift);
        eventTimerFormat2.evtValue.Add(num3);
        eventTimerFormat2.trigger = true;
        SuperGameMaster.evtMgr.TimerAdd(eventTimerFormat2);
        this.ResetFocus();
        SuperGameMaster.UseItem(itemId, 1);
        this.ConfilmUI.GetComponentInParent <UIMaster>().freezeObject(true);
        this.ConfilmUI.GetComponentInParent <UIMaster>().blockUI(true, new Color(0.3f, 0.3f, 0.3f, 0f));
        ConfilmPanel confilm = this.ConfilmUI.GetComponent <ConfilmPanel>();

        confilm.OpenPanel(characterDataFormat.name + "に" + itemDataFormat.name + "\nをふるまいました");
        confilm.ResetOnClick_Screen();
        confilm.SetOnClick_Screen(delegate
        {
            confilm.ClosePanel();
        });
        confilm.SetOnClick_Screen(delegate
        {
            this.ConfilmUI.GetComponentInParent <UIMaster>().freezeObject(false);
        });
        confilm.SetOnClick_Screen(delegate
        {
            this.ConfilmUI.GetComponentInParent <UIMaster>().blockUI(false, new Color(0f, 0f, 0f, 0f));
        });
    }
コード例 #2
0
    // Token: 0x06000476 RID: 1142 RVA: 0x0001FF8C File Offset: 0x0001E38C
    public void ActiveMath(TimerEvent.Type proc_evtType)
    {
        List <EventTimerFormat> list = new List <EventTimerFormat>();

        foreach (EventTimerFormat eventTimerFormat in SuperGameMaster.saveData.evtList_active)
        {
            if (proc_evtType == TimerEvent.Type.NONE || proc_evtType == eventTimerFormat.evtType)
            {
                switch (eventTimerFormat.evtType)
                {
                case TimerEvent.Type.GoTravel:
                    if (eventTimerFormat.timeSpanSec < 0)
                    {
                        SuperGameMaster.set_FlagAdd(Flag.Type.GOTRAVEL, 1);
                    }
                    SuperGameMaster.ResetSave_BagDeskList_virtual();
                    break;

                case TimerEvent.Type.BackHome:
                    SuperGameMaster.ResetSave_BagDeskList_virtual();
                    break;

                case TimerEvent.Type.Picture:
                    if (eventTimerFormat.timeSpanSec < 0)
                    {
                        SuperGameMaster.set_FlagAdd(Flag.Type.GOTRAVEL, 1);
                    }
                    SuperGameMaster.ResetSave_BagDeskList_virtual();
                    break;

                case TimerEvent.Type.Return:
                    SuperGameMaster.ResetSave_BagDeskList_virtual();
                    break;

                case TimerEvent.Type.Friend:
                    if (eventTimerFormat.timeSpanSec <= 0)
                    {
                        int num  = eventTimerFormat.timeSpanSec;
                        int num2 = 0;
                        CharacterDataFormat characterDataFormat = SuperGameMaster.sDataBase.get_CharaDB_forId(eventTimerFormat.evtId);
IL_2E9:
                        while (num + num2 <= 0)
                        {
                            num += 21600;
                            while (UnityEngine.Random.Range(0, 100) >= 10)
                            {
                                num += 1800;
                                if (num > 1296000)
                                {
IL_2C1:
                                    num2  = UnityEngine.Random.Range(6, 9);
                                    num2 *= 1800;
                                    if (characterDataFormat.flagValue > SuperGameMaster.Count_CollectionFlag())
                                    {
                                        num2 = 0;
                                        goto IL_2E9;
                                    }
                                    goto IL_2E9;
                                }
                            }
                            goto IL_2C1;
                        }
                        list.Add(new EventTimerFormat
                        {
                            id          = -1,
                            timeSpanSec = num,
                            activeTime  = num2,
                            addTime     = new DateTime(1970, 1, 1),
                            evtType     = TimerEvent.Type.Friend,
                            evtId       = characterDataFormat.id,
                            evtValue    = new List <int>(),
                            evtValue    =
                            {
                                UnityEngine.Random.Range(0,   characterDataFormat.rndPos.Length),
                                0,
                                eventTimerFormat.evtValue[2],
                                eventTimerFormat.evtValue[3],
                                eventTimerFormat.evtValue[4],
                                0
                            },
                            trigger = false
                        });
                    }
                    break;

                case TimerEvent.Type.Gift:
                {
                    int count = SuperGameMaster.saveData.MailList.Count;
                    if (count >= 100)
                    {
                        SuperGameMaster.saveData.MailList.RemoveAt(0);
                        Debug.Log("[EventTimerManager] 昔のメールを削除しました");
                    }
                    MailEventFormat mailEventFormat = new MailEventFormat();
                    mailEventFormat.NewMail();
                    int evtId = eventTimerFormat.evtId;
                    CharacterDataFormat characterDataFormat2 = SuperGameMaster.sDataBase.get_CharaDB_forId(evtId);
                    Define.Gift         gift = (Define.Gift)eventTimerFormat.evtValue[0];
                    if (gift != Define.Gift.Clover)
                    {
                        if (gift != Define.Gift.FourClover)
                        {
                            if (gift == Define.Gift.Ticket)
                            {
                                mailEventFormat.title  = characterDataFormat2.name + "のおかえし";
                                mailEventFormat.ticket = eventTimerFormat.evtValue[1];
                            }
                        }
                        else
                        {
                            mailEventFormat.title     = characterDataFormat2.name + "のおかえし";
                            mailEventFormat.itemId    = 1000;
                            mailEventFormat.itemStock = eventTimerFormat.evtValue[1];
                        }
                    }
                    else
                    {
                        mailEventFormat.title       = characterDataFormat2.name + "のおかえし";
                        mailEventFormat.CloverPoint = eventTimerFormat.evtValue[1];
                    }
                    mailEventFormat.senderCharaId = characterDataFormat2.id;
                    mailEventFormat.mailEvt       = EvtId.Gift;
                    mailEventFormat.mailId        = SuperGameMaster.saveData.MailList_nextId;
                    mailEventFormat.date          = SuperGameMaster.saveData.lastDateTime;
                    SuperGameMaster.saveData.MailList.Add(mailEventFormat);
                    SuperGameMaster.saveData.MailList_nextId++;
                    Debug.Log(string.Concat(new object[]
                        {
                            "[EventTimerManager] メール追加(",
                            SuperGameMaster.saveData.MailList.Count,
                            ") ID:",
                            mailEventFormat.mailId,
                            " next:",
                            SuperGameMaster.saveData.MailList_nextId
                        }));
                    eventTimerFormat.trigger     = false;
                    eventTimerFormat.timeSpanSec = -1;
                    break;
                }
                }
            }
        }
        foreach (EventTimerFormat addEvt in list)
        {
            SuperGameMaster.evtMgr.TimerAdd(addEvt);
        }
    }