Beispiel #1
0
        /// <summary>
        /// Deserializes the Osmium Json feed format.
        /// </summary>
        /// <param name="ship">The ship.</param>
        /// <param name="feed">The feed.</param>
        /// <returns></returns>
        private static ILoadoutInfo DeserializeOsmiumJsonFeedFormat(Item ship, IEnumerable <SerializableOsmiumLoadoutFeed> feed)
        {
            ILoadoutInfo loadoutInfo = new LoadoutInfo
            {
                Ship = ship
            };

            if (feed == null)
            {
                return(loadoutInfo);
            }

            loadoutInfo.Loadouts
            .AddRange(feed
                      .Select(serialLoadout =>
                              new Loadout
            {
                ID             = serialLoadout.ID,
                Name           = serialLoadout.Name,
                Description    = serialLoadout.RawDescription,
                Author         = serialLoadout.Author.Name,
                Rating         = serialLoadout.Rating,
                SubmissionDate = serialLoadout.CreationDate.UnixTimeStampToDateTime(),
                TopicUrl       = new Uri(serialLoadout.Uri),
                Items          = Enumerable.Empty <Item>()
            }));

            return(loadoutInfo);
        }
Beispiel #2
0
    public void OnConfirmLoadoutRename()
    {
        LoadoutInfo loadoutInfo    = loadoutsList[dropdownLoadouts.value];
        string      newLoadoutName = input_loadoutName.text;

        //here will be validation block or function
        if (newLoadoutName == "")
        {
            Debug.Log("empty name");
            return;
        }

        if (newLoadoutName == loadoutInfo.currentLoadoutName)
        {
            Debug.Log("the same name");
            return;
        }

        foreach (var loadout in loadoutsList)
        {
            if (loadout.currentLoadoutName == newLoadoutName)
            {
                Debug.Log("this name is already exist");
                return;
            }
        }

        loadoutInfo.currentLoadoutName = newLoadoutName;
        loadoutInfo.isSynchronized     = false;
        RefreshLoadouts(dropdownLoadouts.value);
        CloseInputLoadoutName();
    }
    public void Loadout(WeaponType weapon, PerkType perk1, byte perk2)
    {
        ResetPerks();
        if (weapon == WeaponType.Assault)
        {
            SetActiveGun(WeaponType.Assault);
        }
        if (weapon == WeaponType.Railgun)
        {
            SetActiveGun(WeaponType.Railgun);
        }
        if (weapon == WeaponType.Shotgun)
        {
            SetActiveGun(WeaponType.Shotgun);
        }

        loadoutInfo            = new LoadoutInfo();
        loadoutInfo.weaponType = ActiveWeapon;
        loadoutInfo.weaponPerk = perk1;
        SemiGunTeam1.reloading = false;
        SemiGunTeam2.reloading = false;
        AutoGunTeam1.reloading = false;
        AutoGunTeam2.reloading = false;
        ShotgunTeam1.reloading = false;
        ShotgunTeam2.reloading = false;
        RefillAmmoFull();
    }
Beispiel #4
0
 private static void Events_LoadoutEvent(object sender, LoadoutInfo e)
 {
     // TODO: Dump ship loadout for comparisons?
     if (e.ShipName != currentSessions.CurrentShip)
     {
         // Swapped ship
         Console.WriteLine($"Swapped from ship:  {currentSessions.CurrentShip} ID: {currentSessions.CurrentShipIdent}");
         Console.WriteLine($"Swapped to ship:    {e.ShipName} ID: {e.ShipIdent}");
         currentSessions.CurrentShip      = e.ShipName;
         currentSessions.CurrentShipIdent = e.ShipIdent;
     }
 }
Beispiel #5
0
    public void SetItemToLoadout(ShopItem s)
    {
        LoadoutInfo loadoutInfo = loadoutsList[dropdownLoadouts.value];

        switch (s.item.Type)
        {
        case "weapon": loadoutInfo.weapon = s.item; break;

        case "gadget": loadoutInfo.gadget = s.item; break;

        case "skill": loadoutInfo.skill = s.item; break;

        case "skin": loadoutInfo.skin = s.item; break;
        }

        panelInfo.SetButtonAction(s);
        loadoutInfo.isSynchronized = false;
    }
Beispiel #6
0
    static public IEnumerator SynchronizeLoadouts(LoadoutInfo loadoutInfo)
    {
        WWWForm form = new WWWForm();

        form.AddField("currentLoadoutName", loadoutInfo.currentLoadoutName);
        form.AddField("lastLoadoutName", loadoutInfo.lastLoadoutName);
        form.AddField("weapon_id", loadoutInfo.weapon.ID);
        form.AddField("gadget_id", loadoutInfo.gadget.ID);
        form.AddField("skin_id", loadoutInfo.skin.ID);
        form.AddField("skill_id", loadoutInfo.skill.ID);
        form.AddField("player_id", Cmn.player_id);

        WWW synchronize = new WWW(synchronizeLoadoutsURL, form);

        yield return(synchronize);

        Debug.Log(synchronize.error);
        Debug.Log(synchronize.text);
    }
Beispiel #7
0
        public void SetButtonAction(ShopItem shopItem)
        {
            btn_Action.onClick.RemoveAllListeners();
            btn_Action.interactable = true;

            if (shopItem.item.IsBought)
            {
                LoadoutInfo loadoutInfo     = shop.loadoutsList[shop.dropdownLoadouts.value];
                string      loadoutItemName = "";

                switch (shopItem.item.Type)
                {
                case "weapon": loadoutItemName = loadoutInfo.weapon.Name; break;

                case "gadget": loadoutItemName = loadoutInfo.gadget.Name; break;

                case "skill": loadoutItemName = loadoutInfo.skill.Name; break;

                case "skin": loadoutItemName = loadoutInfo.skin.Name; break;
                }

                if (shopItem.item.Name == loadoutItemName)
                {
                    btn_Action.interactable = false;
                    btn_Action.GetComponentInChildren <Text>().text = "Equiped";
                }
                else
                {
                    btn_Action.onClick.AddListener(() => {
                        shop.SetItemToLoadout(shopItem);
                    });
                    btn_Action.GetComponentInChildren <Text>().text = "Equip";
                }
            }
            else
            {
                btn_Action.onClick.AddListener(() => {
                    shop.StartCoroutine(shop.TryToBuyItem(shopItem));
                });
                btn_Action.GetComponentInChildren <Text>().text = "Buy";
            }
        }
Beispiel #8
0
 private void Events_LoadoutEvent(object sender, LoadoutInfo e)
 {
     m_lastRebuy = e.Rebuy;
 }