예제 #1
0
 private void Start()
 {
     string[] array = new string[5]
     {
         "K_SHOOTER1",
         "K_SHOOTER2",
         "K_SHOOTER3",
         "K_SHOOTER4",
         "K_SHOOTER5"
     };
     battleChat = GetComponent <BattleChat>();
     VerifyAudioSource();
     VerifyLocalController();
     tools = new ShooterTool[MyInfoManager.Instance.ShooterTools.Length];
     for (int i = 0; i < MyInfoManager.Instance.ShooterTools.Length; i++)
     {
         tools[i] = null;
         ConsumableDesc consumableDesc = null;
         Item           itemBySequence = MyInfoManager.Instance.GetItemBySequence(MyInfoManager.Instance.ShooterTools[i]);
         if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL)
         {
             TSpecial tSpecial = (TSpecial)itemBySequence.Template;
             string   func     = TItem.FunctionMaskToString(tSpecial.functionMask);
             consumableDesc = ConsumableManager.Instance.Get(func);
             if (consumableDesc != null && !consumableDesc.isShooterTool)
             {
                 consumableDesc = null;
             }
         }
         if (itemBySequence != null && consumableDesc != null)
         {
             tools[i] = new ShooterTool(this, consumableDesc, itemBySequence, base.audio, array[i], custom_inputs.Instance.GetKeyCodeName(array[i]), battleChat, localController);
         }
     }
 }
예제 #2
0
    public TItem GetSpecialItem2HaveFunction(string func)
    {
        int num = TItem.String2FunctionMask(func);

        if (num < 0)
        {
            return(null);
        }
        foreach (KeyValuePair <string, TItem> item in dic)
        {
            if (item.Value.type == TItem.TYPE.SPECIAL)
            {
                TSpecial tSpecial = (TSpecial)item.Value;
                if (tSpecial.functionMask == num)
                {
                    return(item.Value);
                }
            }
            else if (item.Value.type == TItem.TYPE.ACCESSORY)
            {
                TAccessory tAccessory = (TAccessory)item.Value;
                if (tAccessory.functionMask == num)
                {
                    return(item.Value);
                }
            }
        }
        return(null);
    }
예제 #3
0
    public bool CanSpecialUse()
    {
        if (!tItem.IsAmount || amount <= 0 || usage == USAGE.DELETED)
        {
            return(false);
        }
        if (tItem.type != TItem.TYPE.SPECIAL)
        {
            return(false);
        }
        TSpecial tSpecial = (TSpecial)tItem;

        return(tSpecial.functionMask == 24 || tSpecial.functionMask == 25 || tSpecial.functionMask == 26 || tSpecial.functionMask == 80 || tSpecial.functionMask == 87 || tSpecial.functionMask == 92 || tSpecial.functionMask == 93 || tSpecial.functionMask == 94 || tSpecial.functionMask == 95 || tSpecial.functionMask == 96 || tSpecial.functionMask == 97 || tSpecial.functionMask == 98 || tSpecial.functionMask == 99 || tSpecial.functionMask == 100);
    }
예제 #4
0
    public void SpecialUse()
    {
        if (tItem.IsAmount && amount > 0 && usage != USAGE.DELETED && tItem.type == TItem.TYPE.SPECIAL)
        {
            TSpecial tSpecial = (TSpecial)tItem;
            switch (tSpecial.functionMask)
            {
            case 24:
                CSNetManager.Instance.Sock.SendCS_CHARGE_PICKNWIN_COIN_REQ(seq, tSpecial.code);
                break;

            case 25:
                ((AreYouSure)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.ARE_YOU_SURE, exclusive: true))?.InitDialog(this, AreYouSure.SURE.ADD_MAP_SLOT);
                break;

            case 26:
                ((SelectUserMapDlg)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.SELECT_USER_MAP, exclusive: true))?.InitDialog(this);
                break;

            case 80:
                CSNetManager.Instance.Sock.SendCS_CHARGE_FORCE_POINT_REQ(seq, tSpecial.code);
                break;

            case 87:
                ((ChangeNickDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.CHANGE_NICK, exclusive: true))?.InitDialog();
                break;

            case 92:
            case 93:
            case 94:
            case 95:
            case 96:
            case 97:
            case 98:
            case 99:
            case 100:
                ((AreYouSure)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.ARE_YOU_SURE, exclusive: true))?.InitDialog(this, AreYouSure.SURE.RECORD_INIT, tSpecial.functionMask);
                break;
            }
        }
    }
예제 #5
0
    public void DoBuff()
    {
        numBuf       = 0;
        pointBooster = 0f;
        xpBooster    = 0f;
        luck         = 0f;
        if (MyInfoManager.Instance.HaveFunction("premium_account") >= 0)
        {
            xpBooster    += 10f;
            pointBooster += 10f;
        }
        List <long> list = new List <long>();

        for (int i = 0; i < MyInfoManager.Instance.ShooterTools.Length; i++)
        {
            ConsumableDesc consumableDesc = null;
            Item           itemBySequence = MyInfoManager.Instance.GetItemBySequence(MyInfoManager.Instance.ShooterTools[i]);
            if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL && itemBySequence.Amount > 0 && !list.Contains(itemBySequence.Seq))
            {
                itemBySequence.AmountBuf = itemBySequence.Amount;
                list.Add(itemBySequence.Seq);
            }
            if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL && itemBySequence.AmountBuf > 0)
            {
                TSpecial tSpecial = (TSpecial)itemBySequence.Template;
                if (tSpecial.IsConsumableBuff)
                {
                    string func = TItem.FunctionMaskToString(tSpecial.functionMask);
                    consumableDesc = ConsumableManager.Instance.Get(func);
                    if (consumableDesc != null && !consumableDesc.isShooterTool)
                    {
                        consumableDesc = null;
                    }
                    if (consumableDesc != null)
                    {
                        TBuff tBuff = BuffManager.Instance.Get(tSpecial.param);
                        if (tBuff != null)
                        {
                            if (tBuff.IsPoint)
                            {
                                pointBooster += (float)tBuff.PointRatio;
                            }
                            if (tBuff.IsXp)
                            {
                                xpBooster += (float)tBuff.XpRatio;
                            }
                            if (tBuff.IsLuck)
                            {
                                luck += (float)tBuff.Luck;
                            }
                        }
                    }
                    itemBySequence.AmountBuf--;
                }
            }
        }
        list.Clear();
        list = null;
        string[] usings = MyInfoManager.Instance.GetUsings();
        for (int j = 0; j < usings.Length; j++)
        {
            TItem tItem = TItemManager.Instance.Get <TItem>(usings[j]);
            if (tItem != null && tItem.tBuff != null)
            {
                pointBooster += (float)tItem.tBuff.PointRatio;
                xpBooster    += (float)tItem.tBuff.XpRatio;
                luck         += (float)tItem.tBuff.Luck;
            }
        }
        if (pointBooster > 0f)
        {
            numBuf++;
        }
        if (xpBooster > 0f)
        {
            numBuf++;
        }
        if (luck > 0f)
        {
            numBuf++;
        }
        Item[] usingItems = MyInfoManager.Instance.GetUsingItems();
        for (int k = 0; k < usingItems.Length; k++)
        {
            int num  = 0;
            int num2 = 0;
            num  = 10;
            num2 = usingItems[k].upgradeProps[num].grade;
            if (num2 > 0 && usingItems[k].Template.upgradeCategory != TItem.UPGRADE_CATEGORY.NONE)
            {
                pointBooster += PimpManager.Instance.getValue((int)usingItems[k].Template.upgradeCategory, num, num2 - 1);
            }
            num  = 9;
            num2 = usingItems[k].upgradeProps[num].grade;
            if (num2 > 0 && usingItems[k].Template.upgradeCategory != TItem.UPGRADE_CATEGORY.NONE)
            {
                xpBooster += PimpManager.Instance.getValue((int)usingItems[k].Template.upgradeCategory, num, num2 - 1);
            }
            num  = 12;
            num2 = usingItems[k].upgradeProps[num].grade;
            if (num2 > 0 && usingItems[k].Template.upgradeCategory != TItem.UPGRADE_CATEGORY.NONE)
            {
                luck += PimpManager.Instance.getValue((int)usingItems[k].Template.upgradeCategory, num, num2 - 1);
            }
        }
        armor           = MyInfoManager.Instance.SumArmor();
        mainAmmoMax     = MyInfoManager.Instance.SumFunctionFactor("main_ammo_inc");
        auxAmmoMax      = MyInfoManager.Instance.SumFunctionFactor("aux_ammo_inc");
        grenadeMax1     = MyInfoManager.Instance.SumFunctionFactor("special_ammo_inc");
        grenadeMax2     = MyInfoManager.Instance.SumFunctionFactor("special_ammo_add");
        hpCooltime      = MyInfoManager.Instance.SumFunctionFactor("hp_cooltime");
        dashTimeInc     = MyInfoManager.Instance.SumFunctionFactor("dash_time_inc");
        respawnTimeDec  = MyInfoManager.Instance.SumFunctionFactor("respwan_time_dec");
        fallenDamageDec = MyInfoManager.Instance.SumFunctionFactor("fallen_damage_reduce");
        if (armor > 0)
        {
            numBuf++;
        }
        if (mainAmmoMax > 0f)
        {
            numBuf++;
        }
        if (auxAmmoMax > 0f)
        {
            numBuf++;
        }
        if (grenadeMax1 > 0f)
        {
            numBuf++;
        }
        if (grenadeMax2 > 0f)
        {
            numBuf++;
        }
        if (hpCooltime > 0f)
        {
            numBuf++;
        }
        if (dashTimeInc > 0f)
        {
            numBuf++;
        }
        if (respawnTimeDec > 0f)
        {
            numBuf++;
        }
        if (fallenDamageDec > 0f)
        {
            numBuf++;
        }
        bufHeight = (float)(numBuf * 15);
    }
예제 #6
0
    private bool DoBuff(float changeHeight)
    {
        pointBooster = 0f;
        xpBooster    = 0f;
        luck         = 0f;
        if (MyInfoManager.Instance.HaveFunction("premium_account") >= 0)
        {
            xpBooster    += 10f;
            pointBooster += 10f;
        }
        List <long> list = new List <long>();

        for (int i = 0; i < MyInfoManager.Instance.ShooterTools.Length; i++)
        {
            ConsumableDesc consumableDesc = null;
            Item           itemBySequence = MyInfoManager.Instance.GetItemBySequence(MyInfoManager.Instance.ShooterTools[i]);
            if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL && itemBySequence.Amount > 0 && !list.Contains(itemBySequence.Seq))
            {
                itemBySequence.AmountBuf = itemBySequence.Amount;
                list.Add(itemBySequence.Seq);
            }
            if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL && itemBySequence.AmountBuf > 0)
            {
                TSpecial tSpecial = (TSpecial)itemBySequence.Template;
                if (tSpecial.IsConsumableBuff)
                {
                    string func = TItem.FunctionMaskToString(tSpecial.functionMask);
                    consumableDesc = ConsumableManager.Instance.Get(func);
                    if (consumableDesc != null && !consumableDesc.isShooterTool)
                    {
                        consumableDesc = null;
                    }
                    if (consumableDesc != null)
                    {
                        TBuff tBuff = BuffManager.Instance.Get(tSpecial.param);
                        if (tBuff != null)
                        {
                            if (tBuff.IsPoint)
                            {
                                pointBooster += (float)tBuff.PointRatio;
                            }
                            if (tBuff.IsXp)
                            {
                                xpBooster += (float)tBuff.XpRatio;
                            }
                            if (tBuff.IsLuck)
                            {
                                luck += (float)tBuff.Luck;
                            }
                        }
                    }
                    itemBySequence.AmountBuf--;
                }
            }
        }
        list.Clear();
        list = null;
        string[] usings = MyInfoManager.Instance.GetUsings();
        for (int j = 0; j < usings.Length; j++)
        {
            TItem tItem = TItemManager.Instance.Get <TItem>(usings[j]);
            if (tItem != null && tItem.tBuff != null)
            {
                pointBooster += (float)tItem.tBuff.PointRatio;
                xpBooster    += (float)tItem.tBuff.XpRatio;
                luck         += (float)tItem.tBuff.Luck;
            }
        }
        Item[] usingItems = MyInfoManager.Instance.GetUsingItems();
        for (int k = 0; k < usingItems.Length; k++)
        {
            int num  = 0;
            int num2 = 0;
            num  = 10;
            num2 = usingItems[k].upgradeProps[num].grade;
            if (num2 > 0 && usingItems[k].Template.upgradeCategory != TItem.UPGRADE_CATEGORY.NONE)
            {
                pointBooster += PimpManager.Instance.getValue((int)usingItems[k].Template.upgradeCategory, num, num2 - 1);
            }
            num  = 9;
            num2 = usingItems[k].upgradeProps[num].grade;
            if (num2 > 0 && usingItems[k].Template.upgradeCategory != TItem.UPGRADE_CATEGORY.NONE)
            {
                xpBooster += PimpManager.Instance.getValue((int)usingItems[k].Template.upgradeCategory, num, num2 - 1);
            }
            num  = 12;
            num2 = usingItems[k].upgradeProps[num].grade;
            if (num2 > 0 && usingItems[k].Template.upgradeCategory != TItem.UPGRADE_CATEGORY.NONE)
            {
                luck += PimpManager.Instance.getValue((int)usingItems[k].Template.upgradeCategory, num, num2 - 1);
            }
        }
        armor           = MyInfoManager.Instance.SumArmor();
        mainAmmoMax     = MyInfoManager.Instance.SumFunctionFactor("main_ammo_inc");
        auxAmmoMax      = MyInfoManager.Instance.SumFunctionFactor("aux_ammo_inc");
        grenadeMax1     = MyInfoManager.Instance.SumFunctionFactor("special_ammo_inc");
        grenadeMax2     = MyInfoManager.Instance.SumFunctionFactor("special_ammo_add");
        hpCooltime      = MyInfoManager.Instance.SumFunctionFactor("hp_cooltime");
        dashTimeInc     = MyInfoManager.Instance.SumFunctionFactor("dash_time_inc");
        respawnTimeDec  = MyInfoManager.Instance.SumFunctionFactor("respwan_time_dec");
        fallenDamageDec = MyInfoManager.Instance.SumFunctionFactor("fallen_damage_reduce");
        if (pointBooster > 0f || xpBooster > 0f || luck > 0f || armor > 0 || mainAmmoMax > 0f || auxAmmoMax > 0f || grenadeMax1 > 0f || hpCooltime > 0f || grenadeMax2 > 0f || dashTimeInc > 0f || respawnTimeDec > 0f || fallenDamageDec > 0f)
        {
            Texture2D icon = BuffManager.Instance.GetBuffDesc(BuffDesc.WHY.ITEM).icon;
            GUI.Button(new Rect(crdLTBuffIcon.x, crdLTBuffIcon.y - changeHeight, (float)icon.width, (float)icon.height), new GUIContent(icon, "item"), "InvisibleButton");
            return(true);
        }
        return(false);
    }
예제 #7
0
    private void DoShooterToolSlots()
    {
        string[] array = new string[5]
        {
            "K_SHOOTER1",
            "K_SHOOTER2",
            "K_SHOOTER3",
            "K_SHOOTER4",
            "K_SHOOTER5"
        };
        GUI.Box(crdSlotOutline, string.Empty, "BoxInnerLine");
        Rect position = new Rect(crdSlotBtn);

        GUI.BeginGroup(crdSlotOutline);
        for (int i = 0; i < MyInfoManager.Instance.ShooterTools.Length; i++)
        {
            ConsumableDesc consumableDesc = null;
            Item           itemBySequence = MyInfoManager.Instance.GetItemBySequence(MyInfoManager.Instance.ShooterTools[i]);
            if (itemBySequence != null && itemBySequence.IsAmount && itemBySequence.Template != null && itemBySequence.Template.type == TItem.TYPE.SPECIAL)
            {
                TSpecial tSpecial = (TSpecial)itemBySequence.Template;
                string   func     = TItem.FunctionMaskToString(tSpecial.functionMask);
                consumableDesc = ConsumableManager.Instance.Get(func);
                if (consumableDesc != null && !consumableDesc.isShooterTool)
                {
                    consumableDesc = null;
                }
            }
            Texture2D image = null;
            if (itemBySequence != null && consumableDesc != null)
            {
                image = ((!itemBySequence.EnoughToConsume) ? consumableDesc.disable : consumableDesc.enable);
                if (tooltip.ItemSeq == ItemSlot2Tooltip(itemBySequence, i))
                {
                    if (i < 2)
                    {
                        ltTooltip = new Vector2(rc.x + crdSlotOutline.x + position.x + position.width + 5f, rc.y + crdSlotOutline.y + position.y + 5f);
                    }
                    else
                    {
                        ltTooltip = new Vector2(rc.x + crdSlotOutline.x + position.x - tooltip.size.x - 5f, rc.y + crdSlotOutline.y + position.y + 5f);
                    }
                }
            }
            if (GUI.Button(position, new GUIContent(image, ItemSlot2Tooltip(itemBySequence, i)), "BtnItemFixate"))
            {
                curActionSlot = i;
                if (dragItem != null)
                {
                    if (dragItem.IsShooterSlotAble)
                    {
                        CSNetManager.Instance.Sock.SendCS_SET_SHOOTER_TOOL_REQ((sbyte)i, dragItem.Seq);
                    }
                    ResetDragItem();
                }
            }
            LabelUtil.TextOut(new Vector2(position.x + 5f, position.y + 5f), custom_inputs.Instance.GetKeyCodeName(array[i]), "MiniLabel", GlobalVars.Instance.txtMainColor, new Color(0f, 0f, 0f, 0f), TextAnchor.UpperLeft);
            if (curActionSlot == i)
            {
                GUI.Box(position, string.Empty, "BtnItemFixateF");
            }
            position.x += crdSlotBtn.width + 8f;
        }
        GUI.EndGroup();
    }