Example #1
0
        private void Start()
        {
            QuestCampaignData dataOfClass = DataSource.FindDataOfClass <QuestCampaignData>(((Component)this).get_gameObject(), (QuestCampaignData)null);

            if (dataOfClass == null)
            {
                ((Component)this).get_gameObject().SetActive(false);
            }
            else
            {
                if (Object.op_Inequality((Object)this.UnitIcon, (Object)null) && !this.SetUnitIcon(dataOfClass))
                {
                    ((Component)this.UnitIcon).get_gameObject().SetActive(false);
                }
                if (!Object.op_Inequality((Object)this.Text, (Object)null))
                {
                    return;
                }
                this.Text.set_text(this.ValueToString(dataOfClass.value));
            }
        }
Example #2
0
        private bool SetUnitIcon(QuestCampaignData data)
        {
            if (string.IsNullOrEmpty(data.unit))
            {
                return(false);
            }
            GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect();

            UnitParam unitParam = instanceDirect.GetUnitParam(data.unit);

            if (unitParam == null)
            {
                return(false);
            }
            SpriteSheet spriteSheet = AssetManager.Load <SpriteSheet>("ItemIcon/small");
            ItemParam   itemParam   = instanceDirect.GetItemParam((string)unitParam.piece);

            if (Object.op_Inequality((Object)this.UnitIcon, (Object)null))
            {
                this.UnitIcon.set_sprite(spriteSheet.GetSprite((string)itemParam.icon));
            }
            return(true);
        }
Example #3
0
        private void ApplyQuestCampaignParams(string[] campaignIds)
        {
            this.AcquiredUnitExp = new int[this.mRaidResult.members.Count];
            if (campaignIds != null)
            {
                QuestCampaignData[] questCampaigns = MonoSingleton <GameManager> .GetInstanceDirect().FindQuestCampaigns(campaignIds);

                List <UnitData> members  = this.mRaidResult.members;
                float[]         numArray = new float[members.Count];
                float           num1     = 1f;
                for (int index = 0; index < numArray.Length; ++index)
                {
                    numArray[index] = 1f;
                }
                foreach (QuestCampaignData questCampaignData in questCampaigns)
                {
                    QuestCampaignData data = questCampaignData;
                    if (data.type == QuestCampaignValueTypes.ExpUnit)
                    {
                        if (string.IsNullOrEmpty(data.unit))
                        {
                            num1 = data.GetRate();
                        }
                        else
                        {
                            int index = members.FindIndex((Predicate <UnitData>)(value => value.UnitParam.iname == data.unit));
                            if (index >= 0)
                            {
                                numArray[index] = data.GetRate();
                            }
                        }
                    }
                    else if (data.type == QuestCampaignValueTypes.ExpPlayer)
                    {
                        this.mRaidResult.pexp = Mathf.RoundToInt((float)this.mRaidResult.pexp * data.GetRate());
                    }
                }
                int uexp = this.mRaidResult.uexp;
                for (int index = 0; index < numArray.Length; ++index)
                {
                    float num2 = 1f;
                    if ((double)num1 != 1.0 && (double)numArray[index] != 1.0)
                    {
                        num2 = num1 + numArray[index];
                    }
                    else if ((double)num1 != 1.0)
                    {
                        num2 = num1;
                    }
                    else if ((double)numArray[index] != 1.0)
                    {
                        num2 = numArray[index];
                    }
                    this.AcquiredUnitExp[index] = Mathf.RoundToInt((float)uexp * num2);
                }
            }
            else
            {
                for (int index = 0; index < this.AcquiredUnitExp.Length; ++index)
                {
                    this.AcquiredUnitExp[index] = this.mRaidResult.uexp;
                }
            }
        }
Example #4
0
        private void ApplyQuestCampaignParams(string[] campaignIds)
        {
            this.AcquiredUnitExp = new int[this.mUnits.Count];
            if (campaignIds != null)
            {
                QuestCampaignData[] questCampaigns = MonoSingleton <GameManager> .GetInstanceDirect().FindQuestCampaigns(campaignIds);

                List <UnitData> mUnits   = this.mUnits;
                float[]         numArray = new float[mUnits.Count];
                float           num1     = 1f;
                for (int index = 0; index < numArray.Length; ++index)
                {
                    numArray[index] = 1f;
                }
                foreach (QuestCampaignData questCampaignData in questCampaigns)
                {
                    QuestCampaignData data = questCampaignData;
                    if (data.type == QuestCampaignValueTypes.ExpUnit)
                    {
                        if (string.IsNullOrEmpty(data.unit))
                        {
                            num1 = data.GetRate();
                        }
                        else
                        {
                            int index = mUnits.FindIndex((Predicate <UnitData>)(value => value.UnitParam.iname == data.unit));
                            if (index >= 0)
                            {
                                numArray[index] = data.GetRate();
                            }
                        }
                    }
                    else if (data.type == QuestCampaignValueTypes.ExpPlayer)
                    {
                        this.mResultData.Record.playerexp = (OInt)Mathf.RoundToInt((float)(int)this.mResultData.Record.playerexp * data.GetRate());
                    }
                    else if (data.type == QuestCampaignValueTypes.Ap && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextConsumeAp, (UnityEngine.Object)null))
                    {
                        ((Graphic)this.TextConsumeAp).set_color(this.TextConsumeApColor);
                    }
                }
                int unitexp = (int)this.mResultData.Record.unitexp;
                for (int index = 0; index < numArray.Length; ++index)
                {
                    float num2 = 1f;
                    if ((double)num1 != 1.0 && (double)numArray[index] != 1.0)
                    {
                        num2 = num1 + numArray[index];
                    }
                    else if ((double)num1 != 1.0)
                    {
                        num2 = num1;
                    }
                    else if ((double)numArray[index] != 1.0)
                    {
                        num2 = numArray[index];
                    }
                    this.AcquiredUnitExp[index] = Mathf.RoundToInt((float)unitexp * num2);
                }
            }
            else
            {
                for (int index = 0; index < this.AcquiredUnitExp.Length; ++index)
                {
                    this.AcquiredUnitExp[index] = (int)this.mResultData.Record.unitexp;
                }
            }
        }
Example #5
0
        public QuestCampaignData[] MakeData()
        {
            if (this.scope == QuestCampaignScopes.Unit || this.scope == QuestCampaignScopes.UnitAndQuest)
            {
                return new QuestCampaignData[1]
                       {
                           new QuestCampaignData()
                           {
                               type  = QuestCampaignValueTypes.ExpUnit,
                               unit  = this.unit,
                               value = this.expUnit
                           }
                       }
            }
            ;
            int length = 0;

            if (this.apRate != 100)
            {
                ++length;
            }
            if (this.expUnit != 100)
            {
                ++length;
            }
            if (this.expPlayer != 100)
            {
                ++length;
            }
            if (this.dropNum != 100)
            {
                ++length;
            }
            if (this.dropRate != 100)
            {
                ++length;
            }
            if (this.campaignTrust != null)
            {
                if (this.campaignTrust.concept_card != null)
                {
                    ++length;
                }
                if (this.campaignTrust.card_trust_lottery_rate > 0)
                {
                    ++length;
                }
                if (this.campaignTrust.card_trust_qe_bonus > 0)
                {
                    ++length;
                }
            }
            QuestCampaignData[] questCampaignDataArray = new QuestCampaignData[length];
            int index = length - 1;

            if (this.apRate != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.Ap,
                    value = this.apRate
                };
                --index;
            }
            if (this.expUnit != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.ExpUnit,
                    value = this.expUnit
                };
                --index;
            }
            if (this.expPlayer != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.ExpPlayer,
                    value = this.expPlayer
                };
                --index;
            }
            if (this.dropNum != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.DropNum,
                    value = this.dropNum
                };
                --index;
            }
            if (this.dropRate != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.DropRate,
                    value = this.dropRate
                };
                --index;
            }
            if (this.campaignTrust != null)
            {
                if (this.campaignTrust.concept_card != null)
                {
                    questCampaignDataArray[index] = new QuestCampaignData()
                    {
                        type  = QuestCampaignValueTypes.TrustSpecific,
                        value = 0
                    };
                    --index;
                }
                if (this.campaignTrust.card_trust_lottery_rate > 0)
                {
                    questCampaignDataArray[index] = new QuestCampaignData()
                    {
                        type  = QuestCampaignValueTypes.TrustIncidence,
                        value = this.campaignTrust.card_trust_lottery_rate
                    };
                    --index;
                }
                if (this.campaignTrust.card_trust_qe_bonus > 0)
                {
                    questCampaignDataArray[index] = new QuestCampaignData()
                    {
                        type  = QuestCampaignValueTypes.TrustUp,
                        value = this.campaignTrust.card_trust_qe_bonus
                    };
                    int num = index - 1;
                }
            }
            return(questCampaignDataArray);
        }
Example #6
0
        public QuestCampaignData[] MakeData()
        {
            if (this.scope == QuestCampaignScopes.Unit || this.scope == QuestCampaignScopes.UnitAndQuest)
            {
                return new QuestCampaignData[1] {
                           new QuestCampaignData()
                           {
                               type = QuestCampaignValueTypes.ExpUnit, unit = this.unit, value = this.expUnit
                           }
                }
            }
            ;
            int length = 0;

            if (this.apRate != 100)
            {
                ++length;
            }
            if (this.expUnit != 100)
            {
                ++length;
            }
            if (this.expPlayer != 100)
            {
                ++length;
            }
            if (this.dropNum != 100)
            {
                ++length;
            }
            if (this.dropRate != 100)
            {
                ++length;
            }
            QuestCampaignData[] questCampaignDataArray = new QuestCampaignData[length];
            int index = length - 1;

            if (this.apRate != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.Ap,
                    value = this.apRate
                };
                --index;
            }
            if (this.expUnit != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.ExpUnit,
                    value = this.expUnit
                };
                --index;
            }
            if (this.expPlayer != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.ExpPlayer,
                    value = this.expPlayer
                };
                --index;
            }
            if (this.dropNum != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.DropNum,
                    value = this.dropNum
                };
                --index;
            }
            if (this.dropRate != 100)
            {
                questCampaignDataArray[index] = new QuestCampaignData()
                {
                    type  = QuestCampaignValueTypes.DropRate,
                    value = this.dropRate
                };
                int num = index - 1;
            }
            return(questCampaignDataArray);
        }
Example #7
0
        public void RefreshIcons()
        {
            QuestParam dataOfClass1 = DataSource.FindDataOfClass <QuestParam>(((Component)this).get_gameObject(), (QuestParam)null);

            if (dataOfClass1 != null && dataOfClass1.type == QuestTypes.Tower)
            {
                ((Component)this).get_gameObject().SetActive(false);
            }
            else
            {
                QuestCampaignData[] dataOfClass2 = DataSource.FindDataOfClass <QuestCampaignData[]>(((Component)this).get_gameObject(), (QuestCampaignData[])null);
                if (dataOfClass2 == null || dataOfClass2.Length == 0)
                {
                    ((Component)this).get_gameObject().SetActive(false);
                }
                else
                {
                    List <GameObject> gameObjectList = new List <GameObject>();
                    for (int index = 0; index < ((Component)this).get_transform().get_childCount(); ++index)
                    {
                        Transform child = ((Component)this).get_transform().GetChild(index);
                        if (!Object.op_Equality((Object)this.TemplateExpPlayer, (Object)((Component)child).get_gameObject()) && !Object.op_Equality((Object)this.TemplateExpUnit, (Object)((Component)child).get_gameObject()) && (!Object.op_Equality((Object)this.TemplateExpUnitAll, (Object)((Component)child).get_gameObject()) && !Object.op_Equality((Object)this.TemplateDrapItem, (Object)((Component)child).get_gameObject())) && !Object.op_Equality((Object)this.TemplateAp, (Object)((Component)child).get_gameObject()))
                        {
                            gameObjectList.Add(((Component)child).get_gameObject());
                        }
                    }
                    while (gameObjectList.Count != 0)
                    {
                        GameObject gameObject = gameObjectList[0];
                        gameObjectList.Remove(gameObject);
                        Object.DestroyImmediate((Object)gameObject);
                    }
                    bool flag = false;
                    for (int index = 0; index < dataOfClass2.Length && index != 2; ++index)
                    {
                        GameObject        gameObject1 = (GameObject)null;
                        QuestCampaignData data        = dataOfClass2[index];
                        switch (data.type)
                        {
                        case QuestCampaignValueTypes.ExpPlayer:
                            gameObject1 = this.TemplateExpPlayer;
                            break;

                        case QuestCampaignValueTypes.ExpUnit:
                            gameObject1 = !string.IsNullOrEmpty(data.unit) ? this.TemplateExpUnit : this.TemplateExpUnitAll;
                            break;

                        case QuestCampaignValueTypes.DropRate:
                        case QuestCampaignValueTypes.DropNum:
                            if (!flag)
                            {
                                gameObject1 = this.TemplateDrapItem;
                                flag        = true;
                                break;
                            }
                            break;

                        case QuestCampaignValueTypes.Ap:
                            gameObject1 = this.TemplateAp;
                            if (Object.op_Inequality((Object)this.TextConsumeAp, (Object)null))
                            {
                                ((Graphic)this.TextConsumeAp).set_color(this.TextConsumeApColor);
                                break;
                            }
                            break;
                        }
                        if (Object.op_Inequality((Object)gameObject1, (Object)null))
                        {
                            GameObject gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)gameObject1);
                            Vector3    localScale  = gameObject2.get_transform().get_localScale();
                            gameObject2.get_transform().SetParent(((Component)this).get_transform());
                            gameObject2.get_transform().set_localScale(localScale);
                            DataSource.Bind <QuestCampaignData>(gameObject2, data);
                            gameObject2.SetActive(true);
                        }
                    }
                    if (((Component)this).get_gameObject().get_activeSelf())
                    {
                        return;
                    }
                    ((Component)this).get_gameObject().SetActive(true);
                }
            }
        }
Example #8
0
        public QuestCampaignData[] MakeData()
        {
            QuestCampaignData questCampaignData = new QuestCampaignData();

            if (this.scope == QuestCampaignScopes.Unit)
            {
                questCampaignData.type  = QuestCampaignValueTypes.ExpUnit;
                questCampaignData.unit  = this.unit;
                questCampaignData.value = this.expUnit;
                return(new QuestCampaignData[1] {
                    questCampaignData
                });
            }
            if (this.scope == QuestCampaignScopes.UnitAndQuest)
            {
                questCampaignData.unit = this.unit;
            }
            int length = 0;

            if (this.apRate != 100)
            {
                ++length;
            }
            if (this.expUnit != 100)
            {
                ++length;
            }
            if (this.expPlayer != 100)
            {
                ++length;
            }
            if (this.dropNum != 100)
            {
                ++length;
            }
            if (this.dropRate != 100)
            {
                ++length;
            }
            QuestCampaignData[] questCampaignDataArray = new QuestCampaignData[length];
            int index = length - 1;

            if (this.apRate != 100)
            {
                questCampaignData.type        = QuestCampaignValueTypes.Ap;
                questCampaignData.value       = this.apRate;
                questCampaignDataArray[index] = questCampaignData;
                --index;
            }
            if (this.expUnit != 100)
            {
                questCampaignData.type        = QuestCampaignValueTypes.ExpUnit;
                questCampaignData.value       = this.expUnit;
                questCampaignDataArray[index] = questCampaignData;
                --index;
            }
            if (this.expPlayer != 100)
            {
                questCampaignData.type        = QuestCampaignValueTypes.ExpPlayer;
                questCampaignData.value       = this.expPlayer;
                questCampaignDataArray[index] = questCampaignData;
                --index;
            }
            if (this.dropNum != 100)
            {
                questCampaignData.type        = QuestCampaignValueTypes.DropNum;
                questCampaignData.value       = this.dropNum;
                questCampaignDataArray[index] = questCampaignData;
                --index;
            }
            if (this.dropRate != 100)
            {
                questCampaignData.type        = QuestCampaignValueTypes.DropRate;
                questCampaignData.value       = this.dropRate;
                questCampaignDataArray[index] = questCampaignData;
                int num = index - 1;
            }
            return(questCampaignDataArray);
        }
Example #9
0
        public void RefreshIcons()
        {
            this.ResetTemplateActive();
            QuestParam dataOfClass1 = DataSource.FindDataOfClass <QuestParam>(((Component)this).get_gameObject(), (QuestParam)null);

            if (dataOfClass1 != null && dataOfClass1.type == QuestTypes.Tower)
            {
                return;
            }
            QuestCampaignData[] dataOfClass2 = DataSource.FindDataOfClass <QuestCampaignData[]>(((Component)this).get_gameObject(), (QuestCampaignData[])null);
            if (dataOfClass2 == null || dataOfClass2.Length == 0)
            {
                return;
            }
            bool flag = false;

            for (int index = 0; index < dataOfClass2.Length && index != 2; ++index)
            {
                GameObject        gameObject = (GameObject)null;
                QuestCampaignData data       = dataOfClass2[index];
                switch (data.type)
                {
                case QuestCampaignValueTypes.ExpPlayer:
                    gameObject = this.TemplateExpPlayer;
                    break;

                case QuestCampaignValueTypes.ExpUnit:
                    gameObject = !string.IsNullOrEmpty(data.unit) ? this.TemplateExpUnit : this.TemplateExpUnitAll;
                    break;

                case QuestCampaignValueTypes.DropRate:
                case QuestCampaignValueTypes.DropNum:
                    if (!flag)
                    {
                        gameObject = this.TemplateDrapItem;
                        flag       = true;
                        break;
                    }
                    break;

                case QuestCampaignValueTypes.Ap:
                    gameObject = this.TemplateAp;
                    if (Object.op_Inequality((Object)this.TextConsumeAp, (Object)null))
                    {
                        ((Graphic)this.TextConsumeAp).set_color(this.TextConsumeApColor);
                        break;
                    }
                    break;

                case QuestCampaignValueTypes.TrustUp:
                    gameObject = this.TemplateTrustUp;
                    break;

                case QuestCampaignValueTypes.TrustIncidence:
                    gameObject = this.TemplateTrustIncidence;
                    break;

                case QuestCampaignValueTypes.TrustSpecific:
                    gameObject = this.TemplateTrustSpecific;
                    break;
                }
                if (Object.op_Inequality((Object)gameObject, (Object)null))
                {
                    DataSource.Bind <QuestCampaignData>(gameObject, data);
                    gameObject.SetActive(true);
                }
            }
            if (((Component)this).get_gameObject().get_activeSelf())
            {
                return;
            }
            ((Component)this).get_gameObject().SetActive(true);
        }