コード例 #1
0
ファイル: Main.cs プロジェクト: Ragzouken/kooltool-rekindle
    private void LoadDefaultProject()
    {
        var project = CreateSimpleProject();
        SetProject(project);
        editor.tilePalette = project.tiles.Take(16).ToList();
        tiles.SetPalette(editor.tilePalette);

        defaultCostume = NewCostume(project);
    }
コード例 #2
0
 public RoomBlockImageControl(RoomBlock roomBlock, Costume costume, ImageType imageType, int frameIndex)
     : this(roomBlock, costume, imageType, 0, frameIndex, 0)
 {
 }
コード例 #3
0
        public override void SetAndRefreshData(BlockBase blockBase)
        {
            base.SetAndRefreshData(blockBase);

            _costumeBlock = (Costume)blockBase;


            //General
            Header.Text = _costumeBlock.Header;
            Size.Text   = _costumeBlock.Size.ToString();
            Format.Text = _costumeBlock.Format.ToString();
            if (_costumeBlock.HasCloseByte)
            {
                CloseByte.Text = _costumeBlock.CloseByte.ToString();
            }
            else
            {
                CloseByte.Text = string.Empty;
            }

            //Animations
            NumAnimations.Text = _costumeBlock.NumAnim.ToString();
            AnimOffsets.Items.Clear();
            foreach (ushort animationOffset in _costumeBlock.AnimOffsets)
            {
                var item = AnimOffsets.Items.Add(animationOffset.ToString());
            }

            Animations.Nodes.Clear();
            foreach (Animation animation in _costumeBlock.Animations)
            {
                TreeNode nodeAnim = Animations.Nodes.Add(animation.Offset.ToString(), "Offset: " + animation.Offset.ToString());
                nodeAnim.Nodes.Add(string.Format("LimbMask: {0}", animation.LimbMask));
                nodeAnim.Nodes.Add(string.Format("Number of Limbs: {0}", animation.NumLimbs));

                int animationCount = 0;
                foreach (AnimationDefinition animationDefinition in animation.AnimDefinitions)
                {
                    animationCount++;
                    TreeNode definition = nodeAnim.Nodes.Add(string.Format("Animation {0}", animationCount));

                    definition.Nodes.Add(string.Format("Disabled: {0}", animationDefinition.Disabled));
                    definition.Nodes.Add(string.Format("Length: {0}", animationDefinition.Length));
                    definition.Nodes.Add(string.Format("NoLoop: {0}", animationDefinition.NoLoop));
                    definition.Nodes.Add(string.Format("Start: {0}", animationDefinition.Start));
                    definition.Nodes.Add(string.Format("NoLoopAndEndOffset Byte: {0}", animationDefinition.NoLoopAndEndOffset));
                }
            }
            Animations.ExpandAll();

            //Animation commands
            AnimationCommandsOffset.Text = _costumeBlock.AnimCommandsOffset.ToString();
            Commands.Items.Clear();
            foreach (byte command in _costumeBlock.Commands)
            {
                ListViewItem item = Commands.Items.Add(string.Format("{0} - (0x{1})", command, command.ToString("X")));
                if (command >= 0x71 && command <= 0x78)
                {
                    item.SubItems.Add("Add Sound");
                }
                if (command == 0x79)
                {
                    item.SubItems.Add("Stop");
                }
                if (command == 0x7A)
                {
                    item.SubItems.Add("Start");
                }
                if (command == 0x7B)
                {
                    item.SubItems.Add("Hide");
                }
                if (command == 0x7C)
                {
                    item.SubItems.Add("SkipFrame");
                }
            }

            //Limbs
            LimbsOffsets.Items.Clear();
            foreach (ushort limbsOffset in _costumeBlock.LimbsOffsets)
            {
                LimbsOffsets.Items.Add(limbsOffset.ToString());
            }

            int limbNumber = 0;

            Limbs.Nodes.Clear();
            foreach (Limb limb in _costumeBlock.Limbs)
            {
                limbNumber++;
                TreeNode nodeLimb = Limbs.Nodes.Add(string.Format("Limb {0}", limbNumber));
                nodeLimb.Nodes.Add(string.Format("Offset: {0}", limb.OffSet));
                nodeLimb.Nodes.Add(string.Format("Size: {0}", limb.Size));

                TreeNode imageOffsets = nodeLimb.Nodes.Add("Image Offsets:");
                foreach (ushort imageOffset in limb.ImageOffsets)
                {
                    imageOffsets.Nodes.Add(string.Format("Offset: {0}", imageOffset));
                }
            }
            Limbs.ExpandAll();

            //Pictures
            int pictureCount = 0;

            Pictures.Items.Clear();
            foreach (CostumeImageData picture in _costumeBlock.Pictures)
            {
                ListViewItem item = Pictures.Items.Add(pictureCount.ToString());
                item.SubItems.Add(picture.Width.ToString());
                item.SubItems.Add(picture.Height.ToString());
                item.SubItems.Add(picture.RelX.ToString());
                item.SubItems.Add(picture.RelY.ToString());
                item.SubItems.Add(picture.MoveX.ToString());
                item.SubItems.Add(picture.MoveY.ToString());
                item.SubItems.Add(picture.RedirLimb.ToString());
                item.SubItems.Add(picture.RedirPict.ToString());
                item.SubItems.Add(picture.ImageDataSize.ToString());

                pictureCount++;
            }
            Pictures.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

            //Palette Entrys
            PaletteTable.Controls.Clear();
            PaletteData defaultPallete = ((DiskBlock)_costumeBlock.Parent).GetROOM().GetDefaultPalette();

            for (int i = 0; i < _costumeBlock.Palette.Count; i++)
            {
                byte realPaletteIndex = _costumeBlock.Palette[i];


                PaletteColor paletteColor = new PaletteColor(i)
                {
                    BackColor   = defaultPallete.Colors[realPaletteIndex],
                    Width       = 24,
                    Height      = 24,
                    BorderStyle = BorderStyle.FixedSingle,
                    FullPalette = defaultPallete,
                    CanEdit     = true
                };

                paletteColor.PaletteIndex    = realPaletteIndex;
                paletteColor.PaletteChanged += (sender, index, paletteIndex) =>
                {
                    _costumeBlock.Palette[index]           = Convert.ToByte(paletteIndex);
                    PaletteTable.Controls[index].BackColor = defaultPallete.Colors[paletteIndex];
                    ((PaletteColor)PaletteTable.Controls[index]).PaletteIndex = paletteIndex;
                };

                toolTip1.SetToolTip(paletteColor, string.Format("R: {0}, G:{1}, B:{2}", paletteColor.BackColor.R, paletteColor.BackColor.G, paletteColor.BackColor.B));

                PaletteTable.Controls.Add(paletteColor);
            }
        }
コード例 #4
0
        private bool Validate(Costume item)
        {
            bool success = true;

            if (String.IsNullOrEmpty(item.ID))
            {
                this.skinTextBox_ID.Focus();
                success = false;
                GlobalMessageBox.Show("请输入款号!");
            }
            else if (item.ID.Contains("#"))
            {
                this.skinTextBox_ID.Focus();
                success = false;
                GlobalMessageBox.Show("款号不能使用“#”!");
            }
            else if (String.IsNullOrEmpty(item.Name))
            {
                skinTextBox_Name.Focus();
                success = false;
                GlobalMessageBox.Show("请输入名称!");
            }
            else if (item.Price == 0)
            {
                numericUpDown_Price.Focus();
                success = false;
                GlobalMessageBox.Show("价格不能为0!");
            }
            else if (item.Price > 0 && item.Price > Convert.ToDecimal(99999999.99))
            {
                numericUpDown_Price.Focus();
                success = false;
                GlobalMessageBox.Show("价格不能大于99999999.99!");
            }
            else if (item.CostPrice == 0)
            {
                numericUpDownCostPrice.Focus();
                success = false;
                GlobalMessageBox.Show("进货价不能为0!");
            }
            else if (item.CostPrice > 0 && item.CostPrice > Convert.ToDecimal(99999999.99))
            {
                numericUpDownCostPrice.Focus();
                success = false;
                GlobalMessageBox.Show("进货价不能大于99999999.99!");
            }

            else if (item.SalePrice > 0 && item.SalePrice > Convert.ToDecimal(99999999.99))
            {
                numericTextBoxSalePrice.Focus();
                success = false;
                GlobalMessageBox.Show("售价不能大于99999999.99!");
            }

            else if (this.skinComboBox_Year.SelectedValue == null)
            {
                skinComboBox_Year.Focus();
                success = false;
                GlobalMessageBox.Show("请选择年份!");
            }
            else if (String.IsNullOrEmpty(this.skinComboBox_Season.skinComboBox.SelectedValue?.ToString()))
            {
                skinComboBox_Season.skinComboBox.Focus();
                success = false;
                GlobalMessageBox.Show("请选择季节!");
            }
            else if (this.skinComboBoxBigClass.SelectedValue.ClassID == -1)
            {
                skinComboBoxBigClass.Focus();
                success = false;
                GlobalMessageBox.Show("请选择类别!");
            }

            else if (String.IsNullOrEmpty(this.skinComboBox_SupplierID.SelectedValue?.ToString()))
            {
                skinComboBox_SupplierID.Focus();
                success = false;
                GlobalMessageBox.Show("请选择供应商!");
            }
            else if (this.colorComboBox1.SelectedItem != null && String.IsNullOrEmpty(this.colorComboBox1.SelectedValue.ToString()))
            {
                colorComboBox1.Focus();
                success = false;
                GlobalMessageBox.Show("请选择颜色!");
            }

            else if (String.IsNullOrEmpty(this.skinComboBox_Brand.skinComboBox.SelectedValue?.ToString()))
            {
                skinComboBox_Brand.skinComboBox.Focus();
                success = false;
                GlobalMessageBox.Show("请选择品牌!");
            }

            return(success);
        }
コード例 #5
0
 public void Refresh(Costume e)
 {
     CurItem = e;
     Display();
 }
コード例 #6
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ImportLocation.Text))
            {
                return;
            }
            if (!Directory.Exists(ImportLocation.Text))
            {
                return;
            }

            string location = ImportLocation.Text;

            Cursor        = Cursors.WaitCursor;
            Cancel.Cursor = Cursors.Default;

            _cancelImport = false;
            _importing    = true;
            foreach (Control control in Controls)
            {
                if (control.Name != "Cancel" && control.GetType() != typeof(Label) && control.GetType() != typeof(ProgressBar))
                {
                    control.Enabled = false;
                }
            }


            List <ImageInfo> files = Directory.GetFiles(location, "*.png").Select(f => new ImageInfo(f)).ToList();

            Application.DoEvents();

            List <DiskBlock> diskBlocks = _scummFile.DataFile.GetLFLFs();

            Progress.Maximum = files.Count - 1;
            Progress.Value   = 0;
            Progress.Visible = true;

            FilesFound.Text = files.Count.ToString();

            var encoder        = new ImageEncoder();
            var bompEncoder    = new BompImageEncoder();
            var costumeEncoder = new CostumeImageEncoder();
            var zplaneEncoder  = new ZPlaneEncoder();


            for (int i = 0; i < files.Count; i++)
            {
                ImageInfo currentFile      = files[i];
                RoomBlock currentRoomBlock = diskBlocks[currentFile.RoomIndex].GetROOM();
                Bitmap    bitmapToEncode   = (Bitmap)Bitmap.FromFile(currentFile.Filename);

                var    preferredIndexes = new int[0];
                string indexFile        = currentFile.Filename + ".idx";
                if (File.Exists(indexFile))
                {
                    preferredIndexes = File.ReadAllText(indexFile).Split(';').Select(s => Convert.ToInt32(s)).ToArray();
                }


                try
                {
                    switch (currentFile.ImageType)
                    {
                    case ImageType.Background:
                    {
                        encoder.PreferredIndexes = new List <int>(preferredIndexes);
                        encoder.Encode(currentRoomBlock, bitmapToEncode);
                    }
                    break;

                    case ImageType.ZPlane:
                    {
                        zplaneEncoder.Encode(currentRoomBlock, bitmapToEncode, currentFile.ZPlaneIndex);
                    }
                    break;

                    case ImageType.Object:
                        if (currentRoomBlock.GetOBIMs()[currentFile.ObjectIndex].GetIMxx()[currentFile.ImageIndex].GetSMAP() == null)
                        {
                            bompEncoder.PreferredIndexes = new List <int>(preferredIndexes);
                            bompEncoder.Encode(currentRoomBlock, currentFile.ObjectIndex, currentFile.ImageIndex, bitmapToEncode);
                        }
                        else
                        {
                            encoder.PreferredIndexes = new List <int>(preferredIndexes);
                            encoder.Encode(currentRoomBlock, currentFile.ObjectIndex, currentFile.ImageIndex, bitmapToEncode);
                        }
                        break;

                    case ImageType.ObjectsZPlane:
                    {
                        zplaneEncoder.Encode(currentRoomBlock, currentFile.ObjectIndex, currentFile.ImageIndex, bitmapToEncode, currentFile.ZPlaneIndex);
                    }
                    break;

                    case ImageType.Costume:
                    {
                        Costume costume = diskBlocks[currentFile.RoomIndex].GetCostumes()[currentFile.CostumeIndex];
                        costumeEncoder.Encode(currentRoomBlock, costume, currentFile.FrameIndex, bitmapToEncode);
                    }
                    break;
                    }
                }
                catch (ImageEncodeException ex)
                {
                    MessageBox.Show(ex.Message, "Error importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                FilesImported.Text = i.ToString();
                Progress.Value     = i;
                Application.DoEvents();
            }

            MessageBox.Show("All images imported");

            DialogResult = DialogResult.OK;
            Close();
        }
コード例 #7
0
ファイル: PokemonData.cs プロジェクト: kbtbc/Brock-WhMgr
        private async Task <IReadOnlyDictionary <string, string> > GetProperties(DiscordClient client, WhConfig whConfig, string city)
        {
            var pkmnInfo         = Database.Instance.Pokemon[Id];
            var form             = Id.GetPokemonForm(FormId.ToString());
            var costume          = Id.GetCostume(Costume.ToString());
            var gender           = Gender.GetPokemonGenderIconValue();
            var level            = Level;
            var size             = Size?.ToString();
            var weather          = Weather?.ToString();
            var weatherEmoji     = string.Empty;
            var hasWeather       = Weather.HasValue && Weather != WeatherType.None;
            var isWeatherBoosted = pkmnInfo?.IsWeatherBoosted(Weather ?? WeatherType.None);

            if (Weather.HasValue && Strings.WeatherEmojis.ContainsKey(Weather.Value) && Weather != WeatherType.None)
            {
                //TODO: Security check
                weatherEmoji = Weather.Value.GetWeatherEmojiIcon(client.Guilds[whConfig.Discord.EmojiGuildId]);//Strings.WeatherEmojis[Weather.Value];
            }
            var move1 = string.Empty;
            var move2 = string.Empty;

            if (int.TryParse(FastMove, out var fastMoveId) && MasterFile.Instance.Movesets.ContainsKey(fastMoveId))
            {
                move1 = MasterFile.Instance.Movesets[fastMoveId].Name;
            }
            if (int.TryParse(ChargeMove, out var chargeMoveId) && MasterFile.Instance.Movesets.ContainsKey(chargeMoveId))
            {
                move2 = MasterFile.Instance.Movesets[chargeMoveId].Name;
            }
            var type1      = pkmnInfo?.Types?[0];
            var type2      = pkmnInfo?.Types?.Count > 1 ? pkmnInfo.Types?[1] : PokemonType.None;
            var type1Emoji = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) ?
                             pkmnInfo?.Types?[0].GetTypeEmojiIcons(client.Guilds[whConfig.Discord.EmojiGuildId]) :
                             string.Empty;
            var type2Emoji = client.Guilds.ContainsKey(whConfig.Discord.EmojiGuildId) && pkmnInfo?.Types?.Count > 1 ?
                             pkmnInfo?.Types?[1].GetTypeEmojiIcons(client.Guilds[whConfig.Discord.EmojiGuildId]) :
                             string.Empty;
            var typeEmojis   = $"{type1Emoji} {type2Emoji}";
            var catchPokemon = IsDitto ? Database.Instance.Pokemon[DisplayPokemonId ?? Id] : Database.Instance.Pokemon[Id];

            var pkmnImage             = Id.GetPokemonImage(whConfig.Urls.PokemonImage, Gender, FormId, Costume);
            var gmapsLink             = string.Format(Strings.GoogleMaps, Latitude, Longitude);
            var appleMapsLink         = string.Format(Strings.AppleMaps, Latitude, Longitude);
            var wazeMapsLink          = string.Format(Strings.WazeMaps, Latitude, Longitude);
            var staticMapLink         = Utils.PrepareStaticMapUrl(whConfig.Urls.StaticMap, pkmnImage, Latitude, Longitude);
            var gmapsLocationLink     = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? gmapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink);
            var appleMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? appleMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink);
            var wazeMapsLocationLink  = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? wazeMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink);
            //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink);
            var pokestop = Pokestop.Pokestops.ContainsKey(PokestopId) ? Pokestop.Pokestops[PokestopId] : null;

            //var matchesGreatLeague = MatchesGreatLeague();
            //var matchesUltraLeague = MatchesUltraLeague();
            //var isPvP = matchesGreatLeague || matchesUltraLeague;
            //var pvpStats = await GetPvP();

            const string defaultMissingValue = "?";
            var          dict = new Dictionary <string, string>
            {
                //Main properties
                { "pkmn_id", Convert.ToString(Id) },
                { "pkmn_name", pkmnInfo.Name },
                { "pkmn_img_url", pkmnImage },
                { "form", form },
                { "form_id", Convert.ToString(FormId) },
                { "form_id_3", FormId.ToString("D3") },
                { "costume", costume ?? defaultMissingValue },
                { "costume_id", Convert.ToString(Costume) },
                { "costume_id_3", Costume.ToString("D3") },
                { "cp", CP ?? defaultMissingValue },
                { "lvl", level ?? defaultMissingValue },
                { "gender", gender },
                { "size", size ?? defaultMissingValue },
                { "move_1", move1 ?? defaultMissingValue },
                { "move_2", move2 ?? defaultMissingValue },
                { "moveset", $"{move1}/{move2}" },
                { "type_1", type1?.ToString() ?? defaultMissingValue },
                { "type_2", type2?.ToString() ?? defaultMissingValue },
                { "type_1_emoji", type1Emoji },
                { "type_2_emoji", type2Emoji },
                { "types", $"{type1} | {type2}" },
                { "types_emoji", typeEmojis },
                { "atk_iv", Attack ?? defaultMissingValue },
                { "def_iv", Defense ?? defaultMissingValue },
                { "sta_iv", Stamina ?? defaultMissingValue },
                { "iv", IV ?? defaultMissingValue },
                { "iv_rnd", IVRounded ?? defaultMissingValue },

                //PvP stat properties
                //{ "is_great", Convert.ToString(matchesGreatLeague) },
                //{ "is_ultra", Convert.ToString(matchesUltraLeague) },
                //{ "is_pvp", Convert.ToString(isPvP) },
                ////{ "great_league_stats", greatLeagueStats },
                ////{ "ultra_league_stats", ultraLeagueStats },
                //{ "pvp_stats", pvpStats },

                //Other properties
                { "height", Height ?? defaultMissingValue },
                { "weight", Weight ?? defaultMissingValue },
                { "is_ditto", Convert.ToString(IsDitto) },
                { "original_pkmn_id", Convert.ToString(DisplayPokemonId) },
                { "original_pkmn_id_3", (DisplayPokemonId ?? 0).ToString("D3") },
                { "original_pkmn_name", catchPokemon?.Name },
                { "is_weather_boosted", Convert.ToString(isWeatherBoosted) },
                { "has_weather", Convert.ToString(hasWeather) },
                { "weather", weather ?? defaultMissingValue },
                { "weather_emoji", weatherEmoji ?? defaultMissingValue },
                { "username", Username ?? defaultMissingValue },
                { "spawnpoint_id", SpawnpointId ?? defaultMissingValue },
                { "encounter_id", EncounterId ?? defaultMissingValue },

                //Time properties
                { "despawn_time", DespawnTime.ToString("hh:mm:ss tt") },
                { "despawn_time_verified", DisappearTimeVerified ? "" : "~" },
                { "is_despawn_time_verified", Convert.ToString(DisappearTimeVerified) },
                { "time_left", SecondsLeft.ToReadableString(true) ?? defaultMissingValue },

                //Location properties
                { "geofence", city ?? defaultMissingValue },
                { "lat", Convert.ToString(Latitude) },
                { "lng", Convert.ToString(Longitude) },
                { "lat_5", Convert.ToString(Math.Round(Latitude, 5)) },
                { "lng_5", Convert.ToString(Math.Round(Longitude, 5)) },

                //Location links
                { "tilemaps_url", staticMapLink },
                { "gmaps_url", gmapsLocationLink },
                { "applemaps_url", appleMapsLocationLink },
                { "wazemaps_url", wazeMapsLocationLink },

                //Pokestop properties
                { "near_pokestop", Convert.ToString(pokestop != null) },
                { "pokestop_id", PokestopId ?? defaultMissingValue },
                { "pokestop_name", pokestop?.Name ?? defaultMissingValue },
                { "pokestop_url", pokestop?.Url ?? defaultMissingValue },

                //Misc properties
                { "br", "\r\n" }
            };

            return(await Task.FromResult(dict));
        }
コード例 #8
0
        private void DoShowUnCheck()
        {
            try
            {
                uncheckList = new List <CheckStoreDetail>();
                //不在列表中的款號
                InitProgress(shots.Count);
                int k = 0;
                foreach (CostumeStoreHistory item in shots)
                {
                    List <CheckStoreDetail> storeList = costumeStores.FindAll(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && t.ColorName == item.ColorName);
                    if (storeList == null || storeList.Count == 0)
                    {
                        int i = 0;

                        UpdateProgress("正在加载");

                        k++;
                        if (item != null)
                        {
                            CheckStoreDetail store = ToCheckStoreDetail(item);

                            //如果账面数为0不显示
                            if (store.HasNoDiffAtm)
                            {
                                continue;
                            }

                            if (!CheckBrand(store))
                            {
                                continue;
                            }

                            if (i == 0)
                            {
                                store.ShowSelected = true;
                            }
                            uncheckList.Add(store);
                        }
                        i++;
                    }
                    else
                    {
                        //已存在某款某颜色
                        int i = 0;

                        //同款的,只加入不同颜色的
                        //有对应颜色的话,不加入
                        CheckStoreDetail store = storeList.Find(t => t.ColorName == item.ColorName);
                        if (store == null)
                        {
                            //不存在则添加
                            store = new CheckStoreDetail();
                            CJBasic.Helpers.ReflectionHelper.CopyProperty(item, store);
                            ToCheckStoreDetail(store, item);
                            //如果账面数为0不显示
                            if (store.HasNoDiffAtm)
                            {
                                continue;
                            }
                            if (!CheckBrand(store))
                            {
                                continue;
                            }
                            Costume costume = CommonGlobalCache.GetCostume(store.CostumeID);
                            store.CostumeName = costume?.Name;
                            CJBasic.Helpers.ReflectionHelper.CopyProperty(costume, store);
                            if (i == 0)
                            {
                                store.ShowSelected = true;
                            }
                            uncheckList.Add(store);
                            i++;
                        }
                    }
                }

                BindingSource(uncheckList);
            }
            catch (Exception ex)
            {
                FailedProgress(ex);
                ShowError(ex);
            }
            finally
            {
                CompleteProgressForm();
                UnLockPage();
            }
        }
コード例 #9
0
        public bool InsertCostume(Costume costume)
        {
            db.Costumes.Add(costume);

            return(db.SaveChanges() > 0);
        }
コード例 #10
0
        public SystemObject(UniverseIni universe, StarSystem system, Section section, FreelancerData freelancerIni)
            : base(section, freelancerIni)
        {
            if (universe == null)
            {
                throw new ArgumentNullException("universe");
            }
            if (system == null)
            {
                throw new ArgumentNullException("system");
            }
            if (section == null)
            {
                throw new ArgumentNullException("section");
            }

            this.universe      = universe;
            this.system        = system;
            TradelaneSpaceName = new List <int>();

            foreach (Entry e in section)
            {
                if (!parentEntry(e))
                {
                    switch (e.Name.ToLowerInvariant())
                    {
                    case "ambient_color":
                    case "ambient":
                        if (e.Count != 3)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (AmbientColor != null)
                        {
                            FLLog.Warning("Ini", "Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        AmbientColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f);
                        break;

                    case "archetype":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (archetypeName != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        archetypeName = e[0].ToString();
                        break;

                    case "star":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (Star != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        Star = e[0].ToString();
                        break;

                    case "atmosphere_range":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (AtmosphereRange != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        AtmosphereRange = e[0].ToInt32();
                        break;

                    case "burn_color":
                        if (e.Count != 3)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (BurnColor != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        BurnColor = new Color4(e[0].ToInt32() / 255f, e[1].ToInt32() / 255f, e[2].ToInt32() / 255f, 1f);
                        break;

                    case "base":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (baseName != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        baseName = e[0].ToString();
                        break;

                    case "msg_id_prefix":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (MsgIdPrefix != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        MsgIdPrefix = e[0].ToString();
                        break;

                    case "jump_effect":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (JumpEffect != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        JumpEffect = e[0].ToString();
                        break;

                    case "behavior":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (Behavior != null && Behavior != e[0].ToString())
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        Behavior = e[0].ToString();
                        break;

                    case "difficulty_level":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (DifficultyLevel != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        DifficultyLevel = e[0].ToInt32();
                        break;

                    case "goto":
                        if (e.Count != 3)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (Goto != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        Goto = new JumpReference(e[0].ToString(), e[1].ToString(), e[2].ToString());
                        break;

                    case "loadout":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (LoadoutName != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        LoadoutName = e[0].ToString();
                        break;

                    case "pilot":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (Pilot != null && Pilot != e[0].ToString())
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        Pilot = e[0].ToString();
                        break;

                    case "dock_with":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (dockWithName != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        dockWithName = e[0].ToString();
                        break;

                    case "voice":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (Voice != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        Voice = e[0].ToString();
                        break;

                    case "space_costume":
                        if (e.Count < 1 /*|| e.Count > 3*/)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (SpaceCostume != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        SpaceCostume = new Costume(e[0].ToString(), e[1].ToString(), e.Count >= 3 ? e[2].ToString() : string.Empty, freelancerIni);
                        break;

                    case "faction":
                        if (e.Count != 1)
                        {
                            FLLog.Warning("Ini", "Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (Faction != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        Faction = e[0].ToString();
                        break;

                    case "prev_ring":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (PrevRing != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        PrevRing = e[0].ToString();
                        break;

                    case "next_ring":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (nextRingName != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        nextRingName = e[0].ToString();
                        break;

                    case "tradelane_space_name":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        TradelaneSpaceName.Add(e[0].ToInt32());
                        break;

                    case "parent":
                        if (e.Count != 1)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (parentName != null)
                        {
                            throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        parentName = e[0].ToString();
                        break;

                    case "info_card_ids":
                    case "info_card":
                    case "info_ids":
                        if (e.Count == 0)
                        {
                            break;
                        }
                        if (e.Count != 1)
                        {
                            FLLog.Warning("Ini", "Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        if (InfoCardIds != null)
                        {
                            FLLog.Warning("Ini", "Duplicate " + e.Name + " Entry in " + section.Name);
                        }
                        InfoCardIds = e[0].ToInt32();
                        break;

                    case "ring":
                        if (e.Count != 2)
                        {
                            throw new Exception("Invalid number of values in " + section.Name + " Entry " + e.Name + ": " + e.Count);
                        }
                        //if ( != null) throw new Exception("Duplicate " + e.Name + " Entry in " + section.Name);
                        //TODO
                        break;

                    case "260800":                     // Strange error
                        break;

                    case "rot":
                        FLLog.Warning("SystemObject", "unimplemented: rot");
                        break;

                    default:
                        throw new Exception("Invalid Entry in " + section.Name + ": " + e.Name);
                    }
                }
            }
        }
コード例 #11
0
 private void SaveCostumeForm_Costume_Newed(Costume costume)
 {
     //添加到列表中
     costumeFromSupplierTextBox1.Text = costume.ID;
     costumeFromSupplierTextBox1.Search();
 }
コード例 #12
0
	void ApplyCostume(Costume costume)
	{
		var normal = Costumes["Normal"];

		Body.SetAnimation(costume.Body ?? normal.Body);
		Face.SetAnimation(costume.Face ?? normal.Face);
		Headdress.SetAnimation(costume.Headdress ?? normal.Headdress);
		Arms.SetAnimation(costume.Arms ?? normal.Arms);
		Eyes.SetAnimation(costume.Eyes ?? normal.Eyes);
		NeckDecoration.SetAnimation(costume.NeckDecoration ?? normal.NeckDecoration);
		Overlay.SetAnimation(costume.Overlay ?? normal.Overlay);
		OtherOverlay.SetAnimation(costume.OtherOverlay ?? normal.OtherOverlay);
	}
コード例 #13
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                try
                {
                    if (GlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }

                    EmCostume item = (EmCostume)dataGridView1.CurrentRow.DataBoundItem;
                    // item.EmThumbnailData
                    if (curCostume != item && skinCheckBoxShowImage.Checked)
                    {
                        if (imageCtrl != null)
                        {
                            imageCtrl?.Close();
                            imageCtrl = null;
                        }
                        imageCtrl              = new SingleImageForm();
                        imageCtrl.FormClosing += ImageCtrl_FormClosing;
                        imageCtrl.Text         = "款号:" + item.ID;
                        imageCtrl.OnLoadingState(); skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged;
                        skinCheckBoxShowImage.Checked         = true;
                        skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged;
                        Costume CurItem = CommonGlobalCache.GetCostume(item.ID);
                        // byte[] bytes = GlobalCache.ServerProxy.GetCostumePhoto(item.ID);
                        if (item.EmShowOnline)
                        {
                            if (!String.IsNullOrEmpty(item.EmThumbnail))
                            {
                                String url = item.EmThumbnail;
                                System.Net.WebRequest  webreq = System.Net.WebRequest.Create(url);
                                System.Net.WebResponse webres = webreq.GetResponse();
                                using (System.IO.Stream stream = webres.GetResponseStream())
                                {
                                    imageCtrl.Image = Image.FromStream(stream);
                                }
                            }
                            else
                            {
                                imageCtrl.Image = null;
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(CurItem.EmThumbnail))
                            {
                                String url = CurItem.EmThumbnail;
                                System.Net.WebRequest  webreq = System.Net.WebRequest.Create(url);
                                System.Net.WebResponse webres = webreq.GetResponse();
                                using (System.IO.Stream stream = webres.GetResponseStream())
                                {
                                    imageCtrl.Image = Image.FromStream(stream);
                                }
                            }
                            else
                            {
                                imageCtrl.Image = null;
                            }
                        }
                        imageCtrl?.BringToFront();
                        imageCtrl?.Show();
                        curCostume = item;
                    }
                }
                catch (Exception ex)
                {
                    //  GlobalUtil.ShowError(ex);
                }
                finally
                {
                    GlobalUtil.UnLockPage(this);
                }
            }
        }
コード例 #14
0
        private bool Validate(Costume item)
        {
            bool success = true;

            if (String.IsNullOrEmpty(item.ID))
            {
                this.skinTextBox_ID.Focus();
                success = false;
                GlobalMessageBox.Show("请输入款号!");
            }
            else if (item.ID.Contains("#"))
            {
                this.skinTextBox_ID.Focus();
                success = false;
                GlobalMessageBox.Show("款号不能使用“#”!");
            }
            else if (String.IsNullOrEmpty(item.Name))
            {
                skinTextBox_Name.Focus();
                success = false;
                GlobalMessageBox.Show("请输入名称!");
            }
            else if (String.IsNullOrEmpty(item.Colors))
            {
                colorComboBox1.Focus();
                success = false;
                GlobalMessageBox.Show("请选择颜色!");
            }
            //else if (item.Price >Convert.ToDecimal(99999999.99))
            //{
            //    numericUpDown_Price.Focus();
            //    success = false;
            //    GlobalMessageBox.Show("价格不能大于99999999.99!");
            //}
            //else if (item.CostPrice > Convert.ToDecimal(99999999.99))
            //{
            //    numericUpDownCostPrice.Focus();
            //    success = false;
            //    GlobalMessageBox.Show("进货价不能大于99999999.99!");
            //}
            //else if (item.SalePrice > Convert.ToDecimal(99999999.99))
            //{
            //     numericTextBoxSalePrice.Focus();
            //    success = false;
            //    GlobalMessageBox.Show("售价不能大于99999999.99!");
            //}
            else if (String.IsNullOrEmpty(this.skinComboBox_Year.SelectedValue?.ToString()))
            {
                skinComboBox_Year.Focus();
                success = false;
                GlobalMessageBox.Show("请选择年份!");
            }
            else if (String.IsNullOrEmpty(this.skinComboBox_Season.skinComboBox.SelectedValue?.ToString()))
            {
                skinComboBox_Season.skinComboBox.Focus();
                success = false;
                GlobalMessageBox.Show("请选择季节!");
            }
            //else if (String.IsNullOrEmpty(this.skinComboBox_Style.skinComboBox.SelectedValue?.ToString()))
            //{
            //    skinComboBox_Style.skinComboBox.Focus();
            //    success = false;
            //    GlobalMessageBox.Show("请选择风格!");
            //}
            //else if (String.IsNullOrEmpty(this.comboBox_model.skinComboBox.SelectedValue?.ToString()))
            //{
            //    comboBox_model.skinComboBox.Focus();
            //    success = false;
            //    GlobalMessageBox.Show("请选择款型!");
            //}

            //else if (this.skinComboBoxBigClass.SelectedValue.ClassID == -1)
            //{
            //    skinComboBoxBigClass.Focus();
            //    success = false;
            //    GlobalMessageBox.Show("请选择类别!");
            //}

            /* else if (String.IsNullOrEmpty(this.skinComboBox_SupplierID.SelectedValue?.ToString()))
             * {
             *   skinComboBox_SupplierID.Focus();
             *   success = false;
             *   GlobalMessageBox.Show("请选择供应商!");
             * }*/
            else if (String.IsNullOrEmpty(this.skinComboBox_Brand.skinComboBox.SelectedValue?.ToString()))
            {
                skinComboBox_Brand.skinComboBox.Focus();
                success = false;
                GlobalMessageBox.Show("请选择品牌!");
            }
            else if (!string.IsNullOrEmpty(numericUpDown_Price.Text) && Convert.ToDecimal(numericUpDown_Price.Text.ToString()) > Convert.ToDecimal(99999999.99))
            {
                GlobalMessageBox.Show("吊牌价不能大于99999999.99!");
                numericUpDown_Price.Focus();
            }
            else if (!string.IsNullOrEmpty(numericUpDownCostPrice.Text) && Convert.ToDecimal(numericUpDownCostPrice.Text.ToString()) > Convert.ToDecimal(99999999.99))
            {
                GlobalMessageBox.Show("进货价不能大于99999999.99!");
                numericUpDownCostPrice.Focus();
            }
            // 949 新增商品售价允许为0,且不提示
            else if (!string.IsNullOrEmpty(numericTextBoxSalePrice.Text) && Convert.ToDecimal(numericTextBoxSalePrice.Text.ToString()) > Convert.ToDecimal(99999999.99))
            {
                GlobalMessageBox.Show("售价不能大于99999999.99!");
                numericTextBoxSalePrice.Focus();
            }
            return(success);
        }
コード例 #15
0
 void Start()
 {
     gameController = GetComponentInParent <GameController> ();
     spriteMan = GetComponentInChildren <SpriteManager> ();
     // Set a random costume and mark the character clothed
     spriteMan.SetSprite (Enums.RandomCostume ());
     isNaked = false;
     // Ask the character what costume it's wearing and store
     myCostume = spriteMan.MyCostume ();
     isActive = true;
 }
コード例 #16
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            DataGridView    view = (DataGridView)sender;
            DataGridViewRow row  = view.CurrentRow;

            if (row != null && row.Index != -1 && row != currRow)
            {
                currRow = row;
                SalesQuantityRanking ranking = (SalesQuantityRanking)dataGridView1.CurrentRow.DataBoundItem;
                if (showSelection)
                {
                    if (RowSelected != null)
                    {
                        this.skinSplitContainer1.Panel2Collapsed = false;
                        RowSelected.Invoke(ranking, this.pagePara, this.skinSplitContainer1.Panel2);
                    }
                }
                try
                {
                    if (CommonGlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }
                    if (skinCheckBoxShowImage.Checked)
                    {
                        if (imageCtrl != null)
                        {
                            imageCtrl?.Close();
                            imageCtrl = null;
                        }
                        imageCtrl              = new SingleImageForm();
                        imageCtrl.FormClosing += ImageCtrl_FormClosing;
                        imageCtrl.Text         = "款号:" + ranking.CostumeID;
                        imageCtrl.OnLoadingState();
                        skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged;
                        skinCheckBoxShowImage.Checked         = true;
                        skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged;

                        Costume Curitem = CommonGlobalCache.GetCostume(ranking.CostumeID);
                        // byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(ranking.CostumeID);
                        if (Curitem.EmThumbnail != null)
                        {
                            System.Net.WebRequest  webreq = System.Net.WebRequest.Create(Curitem.EmThumbnail);
                            System.Net.WebResponse webres = webreq.GetResponse();
                            using (System.IO.Stream stream = webres.GetResponseStream())
                            {
                                imageCtrl.Image = Image.FromStream(stream);
                            }
                            // imageCtrl.Image = CCWin.SkinControl.ImageHelper.Convert(bytes);
                        }
                        else
                        {
                            imageCtrl.Image = null;
                        }
                        imageCtrl?.BringToFront();
                        imageCtrl?.Show();
                    }
                }
                catch (Exception ex)
                {
                    //  ShowError(ex);
                }
                finally
                {
                    UnLockPage();
                }
            }
        }
コード例 #17
0
        private void BaseButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                item = GetEntity();

                if (!Validate(item))
                {
                    return;
                }
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                RemoveDisposedCostumePhoto();
                UploadCostumePhoto();
                SetProgressInfo("正在保存商品信息……");
                UpdateDisplayIndex();
                if (firstImgUrl != string.Empty)
                {
                    item.EmThumbnail = firstImgUrl;
                }
                InsertCostumeResult result = GlobalCache.ServerProxy.InsertCostume(item);

                if (result == InsertCostumeResult.Error)
                {
                    GlobalMessageBox.Show("内部错误!");
                    return;
                }
                else if (result == InsertCostumeResult.Exist)
                {
                    GlobalMessageBox.Show("该商品已存在!");
                    return;
                }
                else
                {
                    //   UploadCostumePhoto(item);

                    GlobalCache.CostumeList_OnChange(item);


                    ///最后一次保存的尺码组和选择的列


                    //begin 724 商品档案:新增商品后,窗口不要关闭
                    //  this.Hide();
                    //    this.Close();
                    SetProgressVisible(false);
                    ClearNew();
                    if (CostumePhotos != null && CostumePhotos.Count > 0)
                    {
                        CostumePhotos.Clear();
                    }
                    this.titleImageControlWidth1.Clear();
                    GlobalMessageBox.Show("添加成功!");
                    this.skinTextBox_ID.Focus();
                    //end 724 商品档案:新增商品后,窗口不要关闭
                    Costume_Newed?.Invoke(item);
                }
                config.Costume = item;
                config.Save(CONFIG_PATH);
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
コード例 #18
0
 static public void SelectCharacter(int playerNumber, Costume costume)
 {
     costume.taken = true;
     Instance.playerChoices[playerNumber - 1] = costume;
 }
コード例 #19
0
ファイル: AvatarState.cs プロジェクト: planetarium/lib9c
        public void UpdateFromAddCostume(Costume costume, bool canceled)
        {
            var pair = inventory.AddItem2(costume);

            itemMap.Add(pair);
        }
コード例 #20
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                try
                {
                    if (CommonGlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }

                    DataRowView item = (DataRowView)dataGridView1.CurrentRow.DataBoundItem;
                    if (curCostume != item && skinCheckBoxShowImage.Checked)
                    {
                        if (imageCtrl != null)
                        {
                            imageCtrl?.Close();
                            imageCtrl = null;
                        }
                        imageCtrl              = new SingleImageForm();
                        imageCtrl.FormClosing += ImageCtrl_FormClosing;
                        imageCtrl.Text         = "款号:" + item["CostumeID"];
                        imageCtrl.OnLoadingState();
                        skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged;
                        skinCheckBoxShowImage.Checked         = true;
                        skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged;

                        Costume cItem = CommonGlobalCache.GetCostume(item["CostumeID"].ToString());

                        if (cItem.EmThumbnail != "")
                        {
                            String url = cItem.EmThumbnail;
                            System.Net.WebRequest  webreq = System.Net.WebRequest.Create(url);
                            System.Net.WebResponse webres = webreq.GetResponse();
                            using (System.IO.Stream stream = webres.GetResponseStream())
                            {
                                imageCtrl.Image = Image.FromStream(stream);
                            }
                        }
                        else
                        {
                            imageCtrl.Image = null;
                        }

                        /* byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(item["CostumeID"].ToString());
                         * if (bytes != null)
                         * {
                         *   imageCtrl.Image = CCWin.SkinControl.ImageHelper.Convert(bytes);
                         * }
                         * else
                         * {
                         *   imageCtrl.Image = null;
                         * }*/
                        imageCtrl?.BringToFront();
                        imageCtrl?.Show();
                        curCostume = item;
                    }
                }
                catch (Exception ex)
                {
                    // ShowError(ex);
                }
                finally
                {
                    UnLockPage();
                }
            }
        }
コード例 #21
0
        private void BaseButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                item = GetEntity();

                if (!Validate(item))
                {
                    return;
                }
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.CurItem != null)
                {
                    //线上商城原属性不替换
                    item.EmShowOnline  = CurItem.EmShowOnline;
                    item.EmOnlinePrice = CurItem.EmOnlinePrice;
                    item.EmTitle       = CurItem.EmTitle;
                    item.EmThumbnail   = CurItem.EmThumbnail == null ? string.Empty : CurItem.EmThumbnail;
                    item.CreateTime    = CurItem.CreateTime;
                    item.SizeNames     = CurItem.SizeNames;


                    CostumeColor  color     = this.colorComboBox1.SelectedItem;
                    List <string> colorList = CurItem.ColorList;
                    if (colorList != null)
                    {
                        if (curStore.ColorName != color.Name)
                        {
                            colorList.Remove(curStore.ColorName);
                            colorList.Add(color.Name);
                        }
                    }

                    item.Colors = CommonGlobalUtil.GetColorFromGridView(colorList);



                    short F = 0, XS = 0, S = 0, M = 0, L = 0, XL = 0, XL2 = 0, XL3 = 0, XL4 = 0, XL5 = 0, XL6 = 0;
                    if (this.dataGridView2 != null && this.dataGridView2.Rows.Count > 0)
                    {
                        CostumeStore curStoreItem = this.dataGridView2.Rows[0].DataBoundItem as CostumeStore;
                        if (curStoreItem != null)
                        {
                            F   = curStoreItem.F;
                            XS  = curStoreItem.XS;
                            S   = curStoreItem.S;
                            M   = curStoreItem.M;
                            L   = curStoreItem.L;
                            XL  = curStoreItem.XL;
                            XL2 = curStoreItem.XL2;
                            XL3 = curStoreItem.XL3;
                            XL4 = curStoreItem.XL4;
                            XL5 = curStoreItem.XL5;
                            XL6 = curStoreItem.XL6;
                        }
                    }
                    UpdateStartStoreCostumePara updateStorePara = new UpdateStartStoreCostumePara()
                    {
                        BrandID       = item.BrandID,
                        ClassID       = item.ClassID,
                        CostPrice     = item.CostPrice,
                        ID            = item.ID,
                        Name          = item.Name,
                        Price         = item.Price,
                        Remarks       = item.Remarks,
                        SalePrice     = item.SalePrice,
                        Season        = item.Season,
                        SizeGroupName = item.SizeGroupName,
                        SizeNames     = item.SizeNames,
                        SupplierID    = item.SupplierID,
                        Year          = item.Year,
                        OldColorName  = curStore.ColorName,
                        NewColorName  = color.Name,
                        F             = F,
                        XS            = XS,
                        S             = S,
                        L             = L,
                        M             = M,
                        XL            = XL,
                        XL2           = XL2,
                        XL3           = XL3,
                        XL4           = XL4,
                        XL5           = XL5,
                        XL6           = XL6,
                        ShopID        = curStore.ShopID
                    };
                    InteractResult result = GlobalCache.ServerProxy.UpdateStartStoreCostume(updateStorePara);
                    // InteractResult result = GlobalCache.ServerProxy.UpdateCostume(item);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("保存成功!");
                        GlobalCache.CostumeList_OnChange(item);
                        CurItem = item;
                        this.Hide();
                        this.Close();
                        this.DialogResult = DialogResult.OK;
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    CostumeStore costumeStore = dataGridView2.Rows[0].DataBoundItem as CostumeStore;
                    CostumeStore item         = new CostumeStore();
                    ReflectionHelper.CopyProperty(costumeStore, item);
                    item.CostumeID   = skinTextBox_ID.Text;
                    item.CostumeName = skinTextBox_Name.Text;
                    item.Year        = (int)(this.skinComboBox_Year.SelectedValue);
                    item.Price       = numericUpDown_Price.Value;
                    // item.SalePrice =
                    item.CostPrice = numericUpDownCostPrice.Value;
                    item.ClassID   = skinComboBoxBigClass.SelectedValue.ClassID;
                    item.ClassCode = GetClassCode(item.ClassID);

                    //线上商城原属性不替换
                    //  item.BigClass = this.skinComboBoxBigClass.SelectedValue?.BigClass;
                    //  item.SmallClass = this.skinComboBoxBigClass.SelectedValue?.SmallClass;
                    //  item.SubSmallClass = this.skinComboBoxBigClass.SelectedValue?.SubSmallClass;
                    if (this.skinComboBox_Brand.SelectedItem != null)
                    {
                        item.BrandID   = this.skinComboBox_Brand.SelectedItem.AutoID;
                        item.BrandName = this.skinComboBox_Brand.SelectedItem.Name;
                    }
                    item.Season           = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue);
                    item.SupplierID       = skinComboBox_SupplierID.SelectedItem?.ID;
                    item.SupplierName     = skinComboBox_SupplierID.SelectedItem?.Name;
                    item.ColorName        = this.colorComboBox1.SelectedItem?.Name;
                    item.CostumeColorName = this.colorComboBox1.SelectedItem?.Name;
                    List <CostumeStoreExcel> costumeStoreExcels = new List <CostumeStoreExcel>();
                    //item.SizeGroupName= selectSizeGroup.SelectedSizeNames
                    if (selectSizeGroup != null && selectSizeGroup.SizeGroup != null)
                    {
                        item.SizeGroupName     = selectSizeGroup.SizeGroup.SizeGroupName;
                        item.SizeGroupShowName = selectSizeGroup.SizeGroup.ShowName;
                        item.SizeNames         = selectSizeGroup.SelectedSizeNames;
                    }
                    item.SalePrice = this.numericTextBoxSalePrice.Value;
                    costumeStoreExcels.Add(GetCostumeStoreExcel(item));
                    CreateCostumeStore store = new CreateCostumeStore()
                    {
                        ShopID             = shopID,
                        Date               = new CJBasic.Date(),
                        CostumeStoreExcels = costumeStoreExcels,

                        IsImport = true
                    };

                    InteractResult result = GlobalCache.ServerProxy.InsertCostumeStores(store);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("新增成功!");
                        ResetAll();
                        this.Close();
                        SaveClick?.Invoke(item);
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
コード例 #22
0
ファイル: CustomizeHandler.cs プロジェクト: jollitycn/JGNet
        public void HandleInformation(string sourceUserID, int informationType, byte[] info)
        {
            GlobalUtil.WriteLog("收到通知" + informationType);

            #region 充值规则更改
            if (NoticeInformationTypes.UpdateRechargeDonateRule == informationType)
            {
                RechargeDonateRule rechargeDonateRule = CompactPropertySerializer.Default.Deserialize <RechargeDonateRule>(info, 0);
                GlobalCache.UpdateRechargeDonateRule(rechargeDonateRule);
            }
            else if (NoticeInformationTypes.DeleteRechargeDonateRule == informationType)
            {
                GlobalCache.DeleteRechargeDonateRule();
            }
            else if (NoticeInformationTypes.UpdateShopRechargeRuleID == informationType)
            {
                RechargeDonateRule rechargeDonateRule = CompactPropertySerializer.Default.Deserialize <RechargeDonateRule>(info, 0);
                GlobalCache.UpdateShopRechargeRuleID(rechargeDonateRule);
            }

            #endregion

            #region 系统配置更改

            else if (NoticeInformationTypes.UpdateParameterConfig == informationType)
            {
                ParameterConfig c = CompactPropertySerializer.Default.Deserialize <ParameterConfig>(info, 0);
                GlobalCache.ParameterConfig(c);
            }
            else if (NoticeInformationTypes.UpdateParameterConfigs == informationType)
            {
                List <ParameterConfig> collection = CompactPropertySerializer.Default.Deserialize <List <ParameterConfig> >(info, 0);
                foreach (var item in collection)
                {
                    GlobalCache.ParameterConfig(item);
                }
            }

            #endregion

            #region 导购员信息更改
            else if (NoticeInformationTypes.UpdateGuide == informationType)
            {
                Guide guide = CompactPropertySerializer.Default.Deserialize <Guide>(info, 0);
                GlobalCache.UpdateGuide(guide);
            }
            else if (NoticeInformationTypes.InsertGuide == informationType)
            {
                Guide guide = CompactPropertySerializer.Default.Deserialize <Guide>(info, 0);
                GlobalCache.InsertGuide(guide);
            }
            else if (NoticeInformationTypes.DeleteGuide == informationType)
            {
                string guideID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteGuide(guideID);
            }
            else if (NoticeInformationTypes.DeleteGuides == informationType)
            {
                List <String> guideIDs = CompactPropertySerializer.Default.Deserialize <List <String> >(info, 0);
                foreach (var guideID in guideIDs)
                {
                    GlobalCache.DeleteGuide(guideID);
                }
            }
            #endregion

            #region 促销活动更改

            else if (NoticeInformationTypes.InsertSalesPromotion == informationType)
            {
                SalesPromotion salesPromotion = CompactPropertySerializer.Default.Deserialize <SalesPromotion>(info, 0);
                GlobalCache.InsertSalesPromotion(salesPromotion);
            }
            else if (NoticeInformationTypes.DeleteSalesPromotion == informationType)
            {
                string salesPromotionID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteSalesPromotion(salesPromotionID);
            }

            else if (NoticeInformationTypes.UpdateSalesPromotion == informationType)
            {
                SalesPromotion salesPromotion = CompactPropertySerializer.Default.Deserialize <SalesPromotion>(info, 0);
                GlobalCache.UpdateSalesPromotion(salesPromotion);
            }
            #endregion

            #region 品牌配置更改
            else if (NoticeInformationTypes.InsertBrand == informationType)
            {
                Brand brand = CompactPropertySerializer.Default.Deserialize <Brand>(info, 0);
                GlobalCache.InsertBrand(brand);
            }
            else if (NoticeInformationTypes.UpdateBrand == informationType)
            {
                Brand brand = CompactPropertySerializer.Default.Deserialize <Brand>(info, 0);
                GlobalCache.UpdateBrand(brand);
            }
            else if (NoticeInformationTypes.DeleteBrand == informationType)
            {
                int brandID = BitConverter.ToInt32(info, 0);
                GlobalCache.DeleteBrand(brandID);
            }
            #endregion

            #region  装信息更改

            //新增服装
            else if (NoticeInformationTypes.InsertCostume == informationType)
            {
                Costume costume = CompactPropertySerializer.Default.Deserialize <Costume>(info, 0);
                GlobalCache.InsertCostume(costume);
            }
            //服装信息更改
            else if (NoticeInformationTypes.UpdateCostume == informationType)
            {
                Costume costume = CompactPropertySerializer.Default.Deserialize <Costume>(info, 0);
                GlobalCache.UpdateCostume(costume);
            }
            else if (NoticeInformationTypes.DeleteCostume == informationType)
            {
                string costumeID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteCostume(costumeID);
            }
            else if (NoticeInformationTypes.InsertCostumes == informationType)
            {
                List <Costume> costumes = CompactPropertySerializer.Default.Deserialize <List <Costume> >(info, 0);
                foreach (var costume in costumes)
                {
                    GlobalCache.InsertCostume(costume);
                }
            }
            else if (NoticeInformationTypes.UpdateCostumes == informationType)
            {
                List <Costume> costumes = CompactPropertySerializer.Default.Deserialize <List <Costume> >(info, 0);
                foreach (var costume in costumes)
                {
                    GlobalCache.UpdateCostume(costume);
                }
            }
            else if (NoticeInformationTypes.UpdateCostumeValid == informationType)
            {
                UpdateCostumeValidPara result = CompactPropertySerializer.Default.Deserialize <UpdateCostumeValidPara>(info, 0);
                GlobalCache.UpdateCostumeValid(result);
            }
            else if (NoticeInformationTypes.InsertCostumeStores == informationType)
            {
                GlobalCache.LoadCostumeInfos();
            }

            #endregion

            #region 管理员信息更改
            //新增管理员
            else if (NoticeInformationTypes.InsertAdminUser == informationType)
            {
                AdminUser adminUser = CompactPropertySerializer.Default.Deserialize <AdminUser>(info, 0);
                GlobalCache.InsertAdminUser(adminUser);
            }
            //管理员信息更改
            else if (NoticeInformationTypes.UpdateAdminUser == informationType)
            {
                AdminUser adminUser = CompactPropertySerializer.Default.Deserialize <AdminUser>(info, 0);
                GlobalCache.UpdateAdminUser(adminUser);
            }
            #endregion

            #region 供应商信息更改
            //新增供应商
            else if (NoticeInformationTypes.InsertSupplier == informationType)
            {
                Supplier supplier = CompactPropertySerializer.Default.Deserialize <Supplier>(info, 0);
                GlobalCache.InsertSupplier(supplier);
            }
            else if (NoticeInformationTypes.ImportSupplier == informationType)
            {
                List <Supplier> suppliers = CompactPropertySerializer.Default.Deserialize <List <Supplier> >(info, 0);
                if (suppliers != null)
                {
                    foreach (var supplier in suppliers)
                    {
                        GlobalCache.InsertSupplier(supplier);
                    }
                }
            }
            //供应商信息更改
            else if (NoticeInformationTypes.UpdateSupplier == informationType)
            {
                Supplier supplier = CompactPropertySerializer.Default.Deserialize <Supplier>(info, 0);
                GlobalCache.UpdateSupplier(supplier);
            }
            //删除供应商
            else if (NoticeInformationTypes.DeleteSupplier == informationType)
            {
                string supplierID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteSupplier(supplierID);
            }
            #endregion

            #region 店铺更改
            //新增店铺
            else if (NoticeInformationTypes.InsertShop == informationType)
            {
                Shop shop = CompactPropertySerializer.Default.Deserialize <Shop>(info, 0);
                GlobalCache.InsertShop(shop);
            }
            //店铺信息更改
            else if (NoticeInformationTypes.UpdateShop == informationType)
            {
                Shop shop = CompactPropertySerializer.Default.Deserialize <Shop>(info, 0);
                GlobalCache.UpdateShop(shop);
            }
            else if (NoticeInformationTypes.DisableShop == informationType)
            {
                String shopID = Encoding.UTF8.GetString(info);
                GlobalCache.DisableShop(shopID);
            }
            else if (NoticeInformationTypes.DeleteShop == informationType)
            {
                String shopID = Encoding.UTF8.GetString(info);
                GlobalCache.RemoveShop(shopID);
            }
            //Todo:

            #endregion
            else if (NoticeInformationTypes.InsertDifferenceOrder == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);

                DifferenceOrderPagePara checkOrderPagePara = new DifferenceOrderPagePara()
                {
                    OrderID                  = null,
                    CostumeID                = null,
                    IsOpenDate               = true,
                    IsOnlyGetOut             = true,
                    StartDate                = new CJBasic.Date("1900-01-01"),
                    EndDate                  = new CJBasic.Date(DateTime.Now),
                    PageIndex                = 0,
                    PageSize                 = 1000,
                    ShopID                   = CommonGlobalCache.CurrentShopID,
                    OrderPrefixType          = ValidateUtil.CheckEmptyValue(OrderPrefix.AllocateOrder),
                    DifferenceOrderConfirmed = DifferenceOrderConfirmed.False,
                };

                DifferenceOrderPage checkOrderListPage = CommonGlobalCache.ServerProxy.GetDifferenceOrderPage(checkOrderPagePara);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + checkOrderListPage.DifferenceOrderList.Count + "张差异单待处理,请及时处理!" + "#" + informationType);
            }
            #region 新的补货申请单待处理通知
            else if (NoticeInformationTypes.ReplenishOutbound == informationType)
            {
                ReplenishCostumePagePara pageParaReplenish = new ReplenishCostumePagePara()
                {
                    CostumeID           = null,
                    ReplenishOrderID    = null,
                    IsOpenDate          = true,
                    StartDate           = new CJBasic.Date("1900-01-01"),
                    EndDate             = new CJBasic.Date(DateTime.Now),
                    PageIndex           = 0,
                    PageSize            = 10000,
                    ShopID              = CommonGlobalCache.CurrentShopID,
                    ReplenishOrderState = ReplenishOrderState.NotProcessing,
                    BrandID             = -1
                };
                ReplenishCostumePage listPageReplenish = CommonGlobalCache.ServerProxy.GetReplenishCostumePage(pageParaReplenish);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + listPageReplenish.ReplenishOrderList.Count + "张待发货的补货申请单待处理,请及时处理!" + "#" + informationType);
            }
            else if (NoticeInformationTypes.AllocateOutbound == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);
                if (GlobalCache.GetParameter(ParameterConfigKey.AllocateInDirectly)?.ParaValue == "1")
                {
                    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有新的调拨单已入库!");
                }
                else
                {
                    GetAllocateOrdersPara pagePara = new GetAllocateOrdersPara()
                    {
                        AllocateOrderID    = null,
                        AllocateOrderState = AllocateOrderState.Normal,
                        CostumeID          = null,
                        EndDate            = new CJBasic.Date(DateTime.Now),
                        StartDate          = new CJBasic.Date("1900-01-01"),
                        ShopID             = "",
                        Type         = AllocateOrderType.All,
                        PageIndex    = 0,
                        PageSize     = 20,
                        ReceiptState = ReceiptState.WaitReceipt,
                        LockShop     = PermissonUtil.HasPermission(RolePermissionMenuEnum.调拨单查询, RolePermissionEnum.查看_只看本店),
                        DestShopID   = CommonGlobalCache.CurrentShopID,
                        SourceShopID = "",
                    };

                    InteractResult <AllocateOrderPage> listPage = CommonGlobalCache.ServerProxy.GetAllocateOrders(pagePara);
                    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + listPage.Data.AllocateOrderList.Count + "张调拨单待处理,请及时处理!" + "#" + informationType);
                }
            }
            else if (NoticeInformationTypes.ReplenishCostume == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);
                ReplenishCostumePagePara pageParaReplenish = new ReplenishCostumePagePara()
                {
                    CostumeID           = null,
                    ReplenishOrderID    = null,
                    IsOpenDate          = true,
                    StartDate           = new CJBasic.Date("1900-01-01"),
                    EndDate             = new CJBasic.Date(DateTime.Now),
                    PageIndex           = 0,
                    PageSize            = 10000,
                    ShopID              = CommonGlobalCache.CurrentShopID,
                    ReplenishOrderState = ReplenishOrderState.NotProcessing,
                    BrandID             = -1
                };
                ReplenishCostumePage listPageReplenish = CommonGlobalCache.ServerProxy.GetReplenishCostumePage(pageParaReplenish);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有补货申请单待处理,请及时处理!" + "#" + informationType);
            }
            #endregion
            #region 盘点已审核通知
            else if (NoticeInformationTypes.CheckStorePass == informationType)
            {
                GlobalUtil.WriteLog("盘点已审核通知");
                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单已审核,请及时查收!" + "#" + informationType);
                // GlobalUtil.MainForm.OnStoreStateChanged(false);
            }
            #endregion
            #region 盘点退回通知

            /*  else if (NoticeInformationTypes.CancelCheckStore == informationType)
             * {
             *    GlobalUtil.WriteLog("盘点退回通知");
             *    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单被退回,请及时查收!" + "#" + informationType);
             *
             * } */
            #endregion
            #region 补货申请单/调拨单冲单通知
            else if (NoticeInformationTypes.OverrideOrder == informationType)
            {
                string result = String.Empty;
                if (info != null)
                {
                    result = Encoding.UTF8.GetString(info);
                }
                GlobalUtil.WriteLog("补货申请单/或调拨单" + result + "冲单通知");

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的" + GlobalUtil.OrderType(result) + "单" + result + "被冲单,请及时查收!" + "#" + informationType);
            }
            #endregion
            #region 补货申请单取消
            else if (NoticeInformationTypes.CancelReplenish == informationType)
            {
                string result = String.Empty;
                if (info != null)
                {
                    result = Encoding.UTF8.GetString(info);
                }
                GlobalUtil.WriteLog("补货申请单" + result + "取消通知");

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的" + GlobalUtil.OrderType(result) + "单" + result + "被取消,请及时查收!" + "#" + informationType);
            }
            #endregion
            else if (NoticeInformationTypes.NewEmRefundOrder == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);

                GetEmOrderPagePara EmReturnpagePara = new GetEmOrderPagePara()
                {
                    OrderID           = null,
                    StartDate         = new CJBasic.Date("1900-01-01"),
                    EndDate           = new CJBasic.Date(DateTime.Now),
                    PageIndex         = 0,
                    PageSize          = 1000,
                    MemberPhoneOrName = null,
                    CostumeIDOrName   = null,
                    OrderState        = EmRetailOrderState.All,

                    RefundStatus = RefundStatus.Refunding,
                };

                EmOrderPage EmReturnlistPage = CommonGlobalCache.ServerProxy.GetEmOrderPage(EmReturnpagePara);

                int rows = EmReturnlistPage.ResultList.FindAll(t => t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.RefundApplication) || t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.Refunding)).Count;

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + rows + "张线上退货待处理,请及时处理!" + "#" + informationType);
            }
            else if (NoticeInformationTypes.NewEmRetailOrder == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);
                GetEmOrderPagePara EmpagePara = new GetEmOrderPagePara()
                {
                    OrderID           = null,
                    StartDate         = new CJBasic.Date("1900-01-01"),
                    EndDate           = new CJBasic.Date(DateTime.Now),
                    PageIndex         = 0,
                    PageSize          = 1000,
                    MemberPhoneOrName = null,
                    CostumeIDOrName   = null,
                    OrderState        = EmRetailOrderState.WaitDelivery,
                    RefundStatus      = RefundStatus.NotSelect,
                };

                EmOrderPage EmlistPage = CommonGlobalCache.ServerProxy.GetEmOrderPage(EmpagePara);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + EmlistPage.ResultList.Count + "张线上订单待处理,请及时处理!" + "#" + informationType);
            }
            #region 批发客户信息更改
            //新增供应商
            else if (NoticeInformationTypes.InsertPfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.InsertPfCustomer(supplier);
            }
            else if (NoticeInformationTypes.ImportPfCustomer == informationType)
            {
                List <PfCustomer> suppliers = CompactPropertySerializer.Default.Deserialize <List <PfCustomer> >(info, 0);
                foreach (var supplier in suppliers)
                {
                    PfCustomerCache.InsertPfCustomer(supplier);
                }
            }
            //供应商信息更改
            else if (NoticeInformationTypes.UpdatePfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.UpdatePfCustomer(supplier);
            }
            //删除供应商
            else if (NoticeInformationTypes.DeletePfCustomer == informationType)
            {
                string supplierID = Encoding.UTF8.GetString(info);
                PfCustomerCache.DeletePfCustomer(supplierID);
            }
            #endregion
            #region 盘点待处理通知
            else if (NoticeInformationTypes.InsertCheckStore == informationType)
            {
                GlobalUtil.WriteLog("盘点待处理通知");
                CheckStoreOrderPagePara checkPagePara = new CheckStoreOrderPagePara()
                {
                    CheckStoreOrderID = null,
                    IsOpenDate        = true,
                    StartDate         = new CJBasic.Date("1900-01-01"),
                    EndDate           = new CJBasic.Date(DateTime.Now),
                    PageIndex         = 0,
                    PageSize          = 1000,
                    //ShopID = CommonGlobalCache.CurrentShopID,
                    CostumeID = null,
                    State     = CheckStoreOrderState.PendingReview,
                };

                CheckStoreOrderPage ChecklistPage = CommonGlobalCache.ServerProxy.GetCheckStoreOrderPage(checkPagePara);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + ChecklistPage.CheckStoreOrderList.Count + "张盘点单待审核,请及时处理!" + "#" + informationType);
            }
            #endregion
            #region 盘点退回通知
            else if (NoticeInformationTypes.CancelCheckStore == informationType)
            {
                GlobalUtil.WriteLog("盘点退回通知");
                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单被退回,请及时处理!" + "#" + informationType);
            }
            #endregion
            #region 盘点取消通知
            else if (NoticeInformationTypes.CancelCheckStoreTask == informationType)
            {
                GlobalUtil.WriteLog("盘点取消通知");
                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有盘点已取消!");
            }
            #endregion
            else if (NoticeInformationTypes.EnabledSizeGroup == informationType)
            {
                EnabledSizeGroupPara sizeGroup = CompactPropertySerializer.Default.Deserialize <EnabledSizeGroupPara>(info, 0);
                GlobalCache.EnabledSizeGroup(sizeGroup);
            }
            else if (NoticeInformationTypes.InsertSizeGroup == informationType)
            {
                SizeGroup sizeGroup = CompactPropertySerializer.Default.Deserialize <SizeGroup>(info, 0);
                GlobalCache.InsertSizeGroup(sizeGroup);
            }
            else if (NoticeInformationTypes.UpdateSizeGroup == informationType)
            {
                SizeGroup sizeGroup = CompactPropertySerializer.Default.Deserialize <SizeGroup>(info, 0);
                GlobalCache.UpdateSizeGroup(sizeGroup);
            }
            else if (NoticeInformationTypes.DeleteSizeGroup == informationType)
            {
                String SizeGroupName = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteSizeGroup(SizeGroupName);
            }
            else if (NoticeInformationTypes.UpdateSizeNames == informationType)
            {
                UpdateSizeNamesInfo sizeNameInfo = CompactPropertySerializer.Default.Deserialize <UpdateSizeNamesInfo>(info, 0);
                GlobalCache.UpdateSizeNames(sizeNameInfo);
            }
            else if (NoticeInformationTypes.InsertDistributor == informationType)
            {
                Distributor supplier = CompactPropertySerializer.Default.Deserialize <Distributor>(info, 0);
                GlobalCache.InsertDistributor(supplier);
            }
            else if (NoticeInformationTypes.UpdateDistributor == informationType)
            {
                Distributor supplier = CompactPropertySerializer.Default.Deserialize <Distributor>(info, 0);
                GlobalCache.UpdateDistributor(supplier);
            }
            #region 批发客户信息更改
            //新增供应商
            else if (NoticeInformationTypes.InsertPfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.InsertPfCustomer(supplier);
            }
            //供应商信息更改
            else if (NoticeInformationTypes.UpdatePfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.UpdatePfCustomer(supplier);
            }
            //删除供应商
            else if (NoticeInformationTypes.DeletePfCustomer == informationType)
            {
                string supplierID = Encoding.UTF8.GetString(info);
                PfCustomerCache.DeletePfCustomer(supplierID);
            }
            else if (NoticeInformationTypes.SendAnnounce == informationType)
            {
                int      result   = SerializeHelper.ByteArrayToInt(info);
                Announce announce = CompactPropertySerializer.Default.Deserialize <Announce>(info, 0);
                //1:发布中,2:已完成,3:已取消
                AnnounceState state = (AnnounceState)announce.State;

                switch (state)
                {
                case AnnounceState.Finished:
                case AnnounceState.Cancel:
                    ((MainForm)GlobalUtil.MainForm).SendAnnounce(state);
                    break;

                case AnnounceState.Releasing:
                    CommonGlobalCache.SystemUpdateMessage = announce.AnnounceContent;
                    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("系统升级公告\r\n尊敬的客户:\r\n" + announce.AnnounceContent);
                    ((MainForm)GlobalUtil.MainForm).SendAnnounce(state);
                    break;

                default:
                    break;
                }
            }
            else if (NoticeInformationTypes.NoticeClose == informationType)
            {
                ((MainForm)GlobalUtil.MainForm).DoClose();
                //  System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
            }
            #endregion
        }
コード例 #23
0
        private void CostumeCurrentShopTextBox1_CostumeSelected(Costume costumeItem, bool isEnter)
        {
            if (isEnter)
            {
                if (costumeItem != null)
                {
                    this.skinTextBox_Name.Text = costumeItem.Name;
                    if (costumeItem.Name != "")
                    {
                        this.skinTextBox_Name.Enabled = false;
                    }
                    this.numericUpDown_Price.Value = costumeItem.Price;
                    //if (costumeItem.Price > 0)
                    //{
                    this.numericUpDown_Price.Enabled = false;
                    //}
                    this.skinComboBox_Season.skinComboBox.SelectedValue = costumeItem.Season;
                    if (costumeItem.Season != "")
                    {
                        this.skinComboBox_Season.Enabled = false;
                    }
                    this.skinComboBox_Year.SelectedValue = costumeItem.Year;
                    if (costumeItem.Year > 0)
                    {
                        this.skinComboBox_Year.Enabled = false;
                    }
                    this.skinComboBoxBigClass.SelectedValue = costumeItem;
                    if (costumeItem.BigClassID > 0)
                    {
                        this.skinComboBoxBigClass.Enabled = false;
                    }
                    this.skinComboBox_Brand.SelectedValue = costumeItem.BrandID;
                    if (costumeItem.BrandID > 0)
                    {
                        this.skinComboBox_Brand.Enabled = false;
                    }
                    this.skinComboBox_SupplierID.SelectedValue = costumeItem.SupplierID;
                    if (costumeItem.SupplierID != "")
                    {
                        this.skinComboBox_SupplierID.Enabled = false;
                    }
                    this.colorComboBox1.SelectedValue = CommonGlobalCache.GetColorIDByName(costumeItem.Colors.Split(',')[0]);

                    this.numericUpDownCostPrice.Value = costumeItem.CostPrice;

                    //if (costumeItem.CostPrice > 0)
                    //{
                    this.numericUpDownCostPrice.Enabled = false;
                    //}
                    numericTextBoxSalePrice.Value = costumeItem.SalePrice;
                    //if (costumeItem.SalePrice >= 0)
                    //{
                    this.numericTextBoxSalePrice.Enabled = false;
                    //}
                    selectSizeGroup = new SizeGroupSetting();
                    if (costumeItem.SizeNames != "")
                    {
                        baseButtonSelectSizeGroup.Enabled = false;
                    }
                    SizeGroup sizeGroup = GlobalCache.GetSizeGroup(costumeItem?.SizeGroupName);
                    selectSizeGroup.Items     = costumeItem.SizeNameList;
                    selectSizeGroup.SizeGroup = sizeGroup;
                    //this.selectSizeGroup = selectSizeGroup;
                    SetDataGridData();
                    skinLabelSizeGroup.Text = CommonGlobalUtil.GetSizeDisplayNames(sizeGroup, costumeItem?.SizeNames);
                    if (costumeItem.Remarks != null)
                    {
                        this.skinTextBox_Remarks.Text = costumeItem.Remarks;
                    }
                }
                else
                {
                    this.skinTextBox_Name.Enabled        = true;
                    this.numericUpDown_Price.Enabled     = true;
                    this.skinComboBox_Season.Enabled     = true;
                    this.skinComboBox_Year.Enabled       = true;
                    this.skinComboBoxBigClass.Enabled    = true;
                    this.skinComboBox_Brand.Enabled      = true;
                    this.skinComboBox_SupplierID.Enabled = true;
                    this.numericUpDownCostPrice.Enabled  = true;
                    this.numericTextBoxSalePrice.Enabled = true;
                    baseButtonSelectSizeGroup.Enabled    = true;
                }
            }
        }
コード例 #24
0
 private void Form_Costume_Newed(Costume obj)
 {
     this.RefreshPage();
 }
コード例 #25
0
ファイル: PokemonData.cs プロジェクト: AnnexMap/WhMgr
        private async Task <IReadOnlyDictionary <string, string> > GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string pokemonImageUrl)
        {
            var pkmnInfo         = MasterFile.GetPokemon(Id, FormId);
            var pkmnName         = Translator.Instance.GetPokemonName(Id);
            var form             = Translator.Instance.GetFormName(FormId);
            var costume          = Id.GetCostume(Costume.ToString());
            var gender           = Gender.GetPokemonGenderIcon();
            var genderEmoji      = Gender.GetGenderEmojiIcon();
            var level            = Level;
            var size             = Size?.ToString();
            var weather          = Weather?.ToString();
            var hasWeather       = Weather.HasValue && Weather != WeatherType.None;
            var isWeatherBoosted = pkmnInfo?.IsWeatherBoosted(Weather ?? WeatherType.None);
            var weatherKey       = $"weather_{Convert.ToInt32(Weather ?? WeatherType.None)}";
            var weatherEmoji     = string.IsNullOrEmpty(MasterFile.Instance.CustomEmojis[weatherKey])
                ? MasterFile.Instance.CustomEmojis.ContainsKey(weatherKey) && Weather != WeatherType.None
                    ? (Weather ?? WeatherType.None).GetWeatherEmojiIcon()
                    : string.Empty
                : MasterFile.Instance.CustomEmojis[weatherKey];
            var move1 = "Unknown";
            var move2 = "Unknown";

            if (int.TryParse(FastMove, out var fastMoveId))
            {
                move1 = Translator.Instance.GetMoveName(fastMoveId);
            }
            if (int.TryParse(ChargeMove, out var chargeMoveId))
            {
                move2 = Translator.Instance.GetMoveName(chargeMoveId);
            }
            var type1        = pkmnInfo?.Types?[0];
            var type2        = pkmnInfo?.Types?.Count > 1 ? pkmnInfo.Types?[1] : PokemonType.None;
            var type1Emoji   = pkmnInfo?.Types?[0].GetTypeEmojiIcons();
            var type2Emoji   = pkmnInfo?.Types?.Count > 1 ? pkmnInfo?.Types?[1].GetTypeEmojiIcons() : string.Empty;
            var typeEmojis   = $"{type1Emoji} {type2Emoji}";
            var catchPokemon = IsDitto ? Translator.Instance.GetPokemonName(DisplayPokemonId ?? Id) : pkmnName;
            var isShiny      = Shiny ?? false;
            var height       = double.TryParse(Height, out var realHeight) ? Math.Round(realHeight).ToString() : "";
            var weight       = double.TryParse(Weight, out var realWeight) ? Math.Round(realWeight).ToString() : "";

            var gmapsLink               = string.Format(Strings.GoogleMaps, Latitude, Longitude);
            var appleMapsLink           = string.Format(Strings.AppleMaps, Latitude, Longitude);
            var wazeMapsLink            = string.Format(Strings.WazeMaps, Latitude, Longitude);
            var scannerMapsLink         = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude);
            var templatePath            = Path.Combine(whConfig.StaticMaps.TemplatesFolder, whConfig.StaticMaps.Pokemon.TemplateFile);
            var staticMapLink           = Utils.GetStaticMapsUrl(templatePath, whConfig.Urls.StaticMap, whConfig.StaticMaps.Pokemon.ZoomLevel, Latitude, Longitude, pokemonImageUrl, null);
            var gmapsLocationLink       = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? gmapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink);
            var appleMapsLocationLink   = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? appleMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink);
            var wazeMapsLocationLink    = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? wazeMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink);
            var scannerMapsLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? scannerMapsLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink);
            var googleAddress           = Utils.GetGoogleAddress(city, Latitude, Longitude, whConfig.GoogleMapsKey);
            //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink);
            var pokestop = Pokestop.Pokestops.ContainsKey(PokestopId) ? Pokestop.Pokestops[PokestopId] : null;

            var isGreat          = MatchesGreatLeague;
            var isUltra          = MatchesUltraLeague;
            var greatLeagueEmoji = PvPLeague.Great.GetLeagueEmojiIcon();
            var ultraLeagueEmoji = PvPLeague.Ultra.GetLeagueEmojiIcon();
            var isPvP            = isGreat || isUltra;
            var pvpStats         = await GetPvP();

            const string defaultMissingValue = "?";
            var          dict = new Dictionary <string, string>
            {
                // Main properties
                { "pkmn_id", Convert.ToString(Id) },
                { "pkmn_id_3", Id.ToString("D3") },
                { "pkmn_name", pkmnName },
                { "pkmn_img_url", pokemonImageUrl },
                { "form", form },
                { "form_id", Convert.ToString(FormId) },
                { "form_id_3", FormId.ToString("D3") },
                { "costume", costume ?? defaultMissingValue },
                { "costume_id", Convert.ToString(Costume) },
                { "costume_id_3", Costume.ToString("D3") },
                { "cp", CP ?? defaultMissingValue },
                { "lvl", level ?? defaultMissingValue },
                { "gender", gender },
                { "gender_emoji", genderEmoji },
                { "size", size ?? defaultMissingValue },
                { "move_1", move1 ?? defaultMissingValue },
                { "move_2", move2 ?? defaultMissingValue },
                { "moveset", $"{move1}/{move2}" },
                { "type_1", type1?.ToString() ?? defaultMissingValue },
                { "type_2", type2?.ToString() ?? defaultMissingValue },
                { "type_1_emoji", type1Emoji },
                { "type_2_emoji", type2Emoji },
                { "types", $"{type1} | {type2}" },
                { "types_emoji", typeEmojis },
                { "atk_iv", Attack ?? defaultMissingValue },
                { "def_iv", Defense ?? defaultMissingValue },
                { "sta_iv", Stamina ?? defaultMissingValue },
                { "iv", IV ?? defaultMissingValue },
                { "iv_rnd", IVRounded ?? defaultMissingValue },
                { "is_shiny", Convert.ToString(isShiny) },

                // Catch rate properties
                { "has_capture_rates", Convert.ToString(CatchRate1.HasValue && CatchRate2.HasValue && CatchRate3.HasValue) },
                { "capture_1", CatchRate1.HasValue ? Math.Round(CatchRate1.Value * 100, 2).ToString() : string.Empty },
                { "capture_2", CatchRate2.HasValue ? Math.Round(CatchRate2.Value * 100, 2).ToString() : string.Empty },
                { "capture_3", CatchRate3.HasValue ? Math.Round(CatchRate3.Value * 100, 2).ToString() : string.Empty },
                { "capture_1_emoji", CaptureRateType.PokeBall.GetCaptureRateEmojiIcon() },
                { "capture_2_emoji", CaptureRateType.GreatBall.GetCaptureRateEmojiIcon() },
                { "capture_3_emoji", CaptureRateType.UltraBall.GetCaptureRateEmojiIcon() },

                // PvP stat properties
                { "is_great", Convert.ToString(isGreat) },
                { "is_ultra", Convert.ToString(isUltra) },
                { "is_pvp", Convert.ToString(isPvP) },
                //{ "great_league_stats", greatLeagueStats },
                //{ "ultra_league_stats", ultraLeagueStats },
                { "great_league_emoji", greatLeagueEmoji },
                { "ultra_league_emoji", ultraLeagueEmoji },
                { "pvp_stats", pvpStats },

                // Other properties
                { "height", height ?? defaultMissingValue },
                { "weight", weight ?? defaultMissingValue },
                { "is_ditto", Convert.ToString(IsDitto) },
                { "original_pkmn_id", Convert.ToString(DisplayPokemonId) },
                { "original_pkmn_id_3", (DisplayPokemonId ?? 0).ToString("D3") },
                { "original_pkmn_name", catchPokemon },
                { "is_weather_boosted", Convert.ToString(isWeatherBoosted) },
                { "has_weather", Convert.ToString(hasWeather) },
                { "weather", weather ?? defaultMissingValue },
                { "weather_emoji", weatherEmoji ?? defaultMissingValue },
                { "username", Username ?? defaultMissingValue },
                { "spawnpoint_id", SpawnpointId ?? defaultMissingValue },
                { "encounter_id", EncounterId ?? defaultMissingValue },

                // Time properties
                { "despawn_time", DespawnTime.ToString("hh:mm:ss tt") },
                { "despawn_time_24h", DespawnTime.ToString("HH:mm:ss") },
                { "despawn_time_verified", DisappearTimeVerified ? "" : "~" },
                { "is_despawn_time_verified", Convert.ToString(DisappearTimeVerified) },
                { "time_left", SecondsLeft.ToReadableString(true) ?? defaultMissingValue },

                // Location properties
                { "geofence", city ?? defaultMissingValue },
                { "lat", Convert.ToString(Latitude) },
                { "lng", Convert.ToString(Longitude) },
                { "lat_5", Convert.ToString(Math.Round(Latitude, 5)) },
                { "lng_5", Convert.ToString(Math.Round(Longitude, 5)) },

                // Location links
                { "tilemaps_url", staticMapLink },
                { "gmaps_url", gmapsLocationLink },
                { "applemaps_url", appleMapsLocationLink },
                { "wazemaps_url", wazeMapsLocationLink },
                { "scanmaps_url", scannerMapsLocationLink },

                { "address", googleAddress?.Address },

                // Pokestop properties
                { "near_pokestop", Convert.ToString(pokestop != null) },
                { "pokestop_id", PokestopId ?? defaultMissingValue },
                { "pokestop_name", pokestop?.Name ?? defaultMissingValue },
                { "pokestop_url", pokestop?.Url ?? defaultMissingValue },

                // Discord Guild properties
                { "guild_name", guild?.Name },
                { "guild_img_url", guild?.IconUrl },

                // Event properties
                { "is_event", Convert.ToString(IsEvent.HasValue && IsEvent.Value) },

                { "date_time", DateTime.Now.ToString() },

                // Misc properties
                { "br", "\r\n" }
            };

            return(await Task.FromResult(dict));
        }
コード例 #26
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
            {
                return;
            }
            try
            {
                if (e.RowIndex > -1 && e.ColumnIndex > -1)
                {
                    if (GlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }
                    List <Costume> list = (List <Costume>) this.dataGridView1.DataSource;
                    Costume        item = (Costume)list[e.RowIndex];
                    if (e.ColumnIndex == ColumnPrintBarcode.Index)
                    {
                        this.PrintBarCode(item);
                    }
                    else if (e.ColumnIndex == Column1.Index)
                    {//编辑
                        this.OpenModifyDialog(item, this);
                    }
                    else if (e.ColumnIndex == DeleteColumn.Index)
                    {
                        if (GlobalMessageBox.Show("确定删除该商品吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            InteractResult resultCancel = GlobalCache.ServerProxy.DeleteCostume(item.ID);
                            switch (resultCancel.ExeResult)
                            {
                            case ExeResult.Success:
                                GlobalMessageBox.Show("删除成功!");
                                GlobalCache.CostumeList_OnRemove(item);
                                RefreshPage();
                                break;

                            case ExeResult.Error:
                                GlobalMessageBox.Show(resultCancel.Msg);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    else if (e.ColumnIndex == Column2.Index)
                    {  //判断库存
                        UpdateCostumeValidPara para = new UpdateCostumeValidPara()
                        {
                            CostumeID = item.ID,
                            IsValid   = false
                        };
                        InteractResult result = GlobalCache.ServerProxy.UpdateCostumeValid(para);
                        switch (result.ExeResult)
                        {
                        case ExeResult.Success:
                            GlobalMessageBox.Show("禁用成功!");
                            item.IsValid = false;
                            GlobalCache.CostumeList_OnChange(item);
                            RefreshPage();
                            break;

                        case ExeResult.Error:
                            GlobalMessageBox.Show(result.Msg);
                            break;

                        default:
                            break;
                        }
                    }
                    else if (e.ColumnIndex == Column3.Index)
                    {
                        UpdateCostumeValidPara paraCancel = new UpdateCostumeValidPara()
                        {
                            CostumeID = item.ID,
                            IsValid   = true
                        };
                        InteractResult resultCancel = GlobalCache.ServerProxy.UpdateCostumeValid(paraCancel);
                        switch (resultCancel.ExeResult)
                        {
                        case ExeResult.Success:
                            GlobalMessageBox.Show("取消禁用成功!");
                            item.IsValid = true;
                            GlobalCache.CostumeList_OnChange(item);
                            RefreshPage();
                            break;

                        case ExeResult.Error:
                            GlobalMessageBox.Show(resultCancel.Msg);
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
コード例 #27
0
        private IReadOnlyDictionary <string, string> GetProperties(DiscordGuild guild, WhConfig whConfig, string city, string raidImageUrl)
        {
            var pkmnInfo        = MasterFile.GetPokemon(PokemonId, Form);
            var name            = IsEgg ? "Egg" /*TODO: Localize*/ : Translator.Instance.GetPokemonName(PokemonId);
            var form            = Translator.Instance.GetFormName(Form);
            var costume         = Translator.Instance.GetCostumeName(Costume);
            var evo             = Translator.Instance.GetEvolutionName(Evolution);
            var gender          = Gender.GetPokemonGenderIcon();
            var level           = Level;
            var move1           = Translator.Instance.GetMoveName(FastMove);
            var move2           = Translator.Instance.GetMoveName(ChargeMove);
            var types           = pkmnInfo?.Types;
            var type1           = types?[0];
            var type2           = types?.Count > 1 ? types?[1] : PokemonType.None;
            var type1Emoji      = types?[0].GetTypeEmojiIcons();
            var type2Emoji      = pkmnInfo?.Types?.Count > 1 ? types?[1].GetTypeEmojiIcons() : string.Empty;
            var typeEmojis      = $"{type1Emoji} {type2Emoji}";
            var weaknesses      = Weaknesses == null ? string.Empty : string.Join(", ", Weaknesses);
            var weaknessesEmoji = types?.GetWeaknessEmojiIcons();
            var perfectRange    = PokemonId.MaxCpAtLevel(20);
            var boostedRange    = PokemonId.MaxCpAtLevel(25);
            var worstRange      = PokemonId.MinCpAtLevel(20);
            var worstBoosted    = PokemonId.MinCpAtLevel(25);
            var exEmojiId       = MasterFile.Instance.Emojis["ex"];
            var exEmoji         = exEmojiId > 0 ? $"<:ex:{exEmojiId}>" : "EX";
            var teamEmojiId     = MasterFile.Instance.Emojis[Team.ToString().ToLower()];
            var teamEmoji       = teamEmojiId > 0 ? $"<:{Team.ToString().ToLower()}:{teamEmojiId}>" : Team.ToString();

            var gmapsLink               = string.Format(Strings.GoogleMaps, Latitude, Longitude);
            var appleMapsLink           = string.Format(Strings.AppleMaps, Latitude, Longitude);
            var wazeMapsLink            = string.Format(Strings.WazeMaps, Latitude, Longitude);
            var scannerMapsLink         = string.Format(whConfig.Urls.ScannerMap, Latitude, Longitude);
            var staticMapLink           = StaticMap.GetUrl(whConfig.Urls.StaticMap, whConfig.StaticMaps["raids"], Latitude, Longitude, raidImageUrl, Team);
            var gmapsLocationLink       = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, gmapsLink);
            var appleMapsLocationLink   = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, appleMapsLink);
            var wazeMapsLocationLink    = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, wazeMapsLink);
            var scannerMapsLocationLink = UrlShortener.CreateShortUrl(whConfig.ShortUrlApiUrl, scannerMapsLink);
            var address = new Location(null, city, Latitude, Longitude).GetAddress(whConfig);
            //var staticMapLocationLink = string.IsNullOrEmpty(whConfig.ShortUrlApiUrl) ? staticMapLink : NetUtil.CreateShortUrl(whConfig.ShortUrlApiUrl, staticMapLink);

            var now           = DateTime.UtcNow.ConvertTimeFromCoordinates(Latitude, Longitude);
            var startTimeLeft = now.GetTimeRemaining(StartTime).ToReadableStringNoSeconds();
            var endTimeLeft   = now.GetTimeRemaining(EndTime).ToReadableStringNoSeconds();

            const string defaultMissingValue = "?";
            var          dict = new Dictionary <string, string>
            {
                //Raid boss properties
                { "pkmn_id", PokemonId.ToString() },
                { "pkmn_id_3", PokemonId.ToString("D3") },
                { "pkmn_name", name },
                { "pkmn_img_url", raidImageUrl },
                { "evolution", evo },
                { "evolution_id", Convert.ToInt32(Evolution).ToString() },
                { "evolution_id_3", Evolution.ToString("D3") },
                { "form", form },
                { "form_id", Form.ToString() },
                { "form_id_3", Form.ToString("D3") },
                { "costume", costume },
                { "costume_id", Costume.ToString() },
                { "costume_id_3", Costume.ToString("D3") },
                { "is_egg", Convert.ToString(IsEgg) },
                { "is_ex", Convert.ToString(IsExEligible) },
                { "ex_emoji", exEmoji },
                { "team", Team.ToString() },
                { "team_id", Convert.ToInt32(Team).ToString() },
                { "team_emoji", teamEmoji },
                { "cp", CP ?? defaultMissingValue },
                { "lvl", level ?? defaultMissingValue },
                { "gender", gender ?? defaultMissingValue },
                { "move_1", move1 ?? defaultMissingValue },
                { "move_2", move2 ?? defaultMissingValue },
                { "moveset", $"{move1}/{move2}" },
                { "type_1", type1?.ToString() ?? defaultMissingValue },
                { "type_2", type2?.ToString() ?? defaultMissingValue },
                { "type_1_emoji", type1Emoji },
                { "type_2_emoji", type2Emoji },
                { "types", $"{type1}/{type2}" },
                { "types_emoji", typeEmojis },
                { "weaknesses", weaknesses },
                { "weaknesses_emoji", weaknessesEmoji },
                { "perfect_cp", perfectRange.ToString() },
                { "perfect_cp_boosted", boostedRange.ToString() },
                { "worst_cp", worstRange.ToString() },
                { "worst_cp_boosted", worstBoosted.ToString() },

                //Time properties
                { "start_time", StartTime.ToLongTimeString() },
                { "start_time_24h", StartTime.ToString("HH:mm:ss") },
                { "start_time_left", startTimeLeft },
                { "end_time", EndTime.ToLongTimeString() },
                { "end_time_24h", EndTime.ToString("HH:mm:ss") },
                { "end_time_left", endTimeLeft },

                //Location properties
                { "geofence", city ?? defaultMissingValue },
                { "lat", Latitude.ToString() },
                { "lng", Longitude.ToString() },
                { "lat_5", Latitude.ToString("0.00000") },
                { "lng_5", Longitude.ToString("0.00000") },

                //Location links
                { "tilemaps_url", staticMapLink },
                { "gmaps_url", gmapsLocationLink },
                { "applemaps_url", appleMapsLocationLink },
                { "wazemaps_url", wazeMapsLocationLink },
                { "scanmaps_url", scannerMapsLocationLink },

                { "address", address?.Address },

                //Gym properties
                { "gym_id", GymId },
                { "gym_name", GymName },
                { "gym_url", GymUrl },

                // Discord Guild properties
                { "guild_name", guild?.Name },
                { "guild_img_url", guild?.IconUrl },

                { "date_time", DateTime.Now.ToString() },

                //Misc properties
                { "br", "\r\n" }
            };

            return(dict);
        }
コード例 #28
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                try
                {
                    if (GlobalUtil.EngineUnconnectioned(this))
                    {
                        return;
                    }

                    Costume item = (Costume)dataGridView1.CurrentRow.DataBoundItem;
                    if (curCostume != item && skinCheckBoxShowImage.Checked)
                    {
                        if (imageCtrl != null)
                        {
                            imageCtrl?.Close();
                            imageCtrl = null;
                        }
                        imageCtrl = new SingleImageForm();
                        skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged;
                        skinCheckBoxShowImage.Checked         = true;
                        skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged;

                        imageCtrl.FormClosing += ImageCtrl_FormClosing;
                        imageCtrl.Text         = "款号:" + item.ID;
                        imageCtrl.OnLoadingState();
                        Image img = null;
                        //InteractResult<string> result = GlobalCache.ServerProxy.GetMainCostumePhotoAddress(item.ID);
                        // if (result.ExeResult == ExeResult.Success)
                        // {
                        //     String savePath = GlobalUtil.EmallDir + Path.GetFileName(result.Data);

                        try
                        {
                            /*  if (!File.Exists(savePath))
                             * {
                             *    CosCloud.DownloadFile(CosLoginInfo.BucketName, result.Data, savePath);
                             * }
                             * img = JGNet.Core.ImageHelper.FromFileStream(savePath);*/
                            if (item.EmThumbnail != null)
                            {
                                String url = item.EmThumbnail;
                                System.Net.WebRequest  webreq = System.Net.WebRequest.Create(url);
                                System.Net.WebResponse webres = webreq.GetResponse();
                                using (System.IO.Stream stream = webres.GetResponseStream())
                                {
                                    img = Image.FromStream(stream);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            //下载失败,可能文件被占用,直接使用该文件即可。
                            //文件找不到使用默认图片,找不到
                        }
                        //}
                        if (img != null)
                        {
                            imageCtrl.Image = img;
                        }
                        else
                        {
                            imageCtrl.Image = null;
                        }
                        imageCtrl?.BringToFront();
                        imageCtrl?.Show();
                        curCostume = item;
                    }
                }
                catch (Exception ex)
                {
                    //  GlobalUtil.ShowError(ex);
                }
                finally
                {
                    GlobalUtil.UnLockPage(this);
                }
            }
        }
コード例 #29
0
        private void BaseButton_OK_Click(object sender, EventArgs e)
        {
            try
            {
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                if (dataGridView1.Rows.Count > 0)
                {
                    int                index            = this.dataGridView1.SelectedCells[0].RowIndex;
                    Costume            curCostume       = currentSource[index];
                    List <CostumeItem> selectResultItem = CommonGlobalCache.ServerProxy.GetPfCustomerStores(CustomerID, curCostume.ID, true);

                    /*   List<CostumeItem> selectResultItem = CommonGlobalCache.ServerProxy.GetCostumeStoreList(new CostumeStoreListPara()
                     * {
                     *     CostumeID = curCostume.ID,
                     *     ShopID = this.ShopID,
                     *     IsOnlyShowValid = filterValid,
                     *     IsAccurateQuery = true,
                     *
                     * });
                     */
                    if (curSuplierId != null && curCostume != null)
                    {
                        selectResultItem = selectResultItem.FindAll(i => i.Costume.SupplierID == curSuplierId);
                    }
                    if (selectResultItem.Count > 0)
                    {
                        this.ConfirmSelectCell(selectResultItem[0]);
                    }
                    else
                    {
                        CostumeItem         pfCostumeItem = new CostumeItem();
                        List <CostumeStore> cStore        = new List <CostumeStore>();
                        pfCostumeItem.Costume = curCostume;

                        String[] colors = CommonGlobalUtil.GetStringSplit(pfCostumeItem.Costume.Colors, ',');
                        //创建虚拟库存信息
                        foreach (var color in colors)
                        {
                            //color not existed,then add one
                            cStore.Add(SetupStores(pfCostumeItem, color));
                        }

                        pfCostumeItem.CostumeStoreList = cStore;
                        this.ConfirmSelectCell(pfCostumeItem);
                        //curCostume.ColorList
                        //pfCostumeItem.CostumeStoreList = cStore;
                        //  ShowMessage("该店铺不存在该商品!");
                    }
                }
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }

            finally
            {
                UnLockPage();
            }
        }
コード例 #30
0
        /// <summary>
        /// 导入数据
        /// </summary>
        private void DoImport()
        {
            try
            {
                List <Costume> emptyStore         = new List <Costume>();
                List <Costume> stores             = new List <Costume>();
                List <Costume> repeatItems        = new List <Costume>();
                DataTable      dt                 = NPOIHelper.FormatToDatatable(path, 0);
                List <int>     NoNullRows         = new List <int>(); //必填项不为空集合
                List <int>     IDRepeatRows       = new List <int>(); //款号重复集合
                List <int>     ErrorSizeRows      = new List <int>(); //尺码格式不正确
                List <int>     ErrorGroupNameRows = new List <int>(); //尺码组名称不存在
                List <int>     ErrorIdOrName      = new List <int>(); //款号或名称长度不正确

                List <EmCostumePhoto> listPhoto = ExcelToImage(path, GlobalUtil.EmallDir);

                #region //数据处理
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow row   = dt.Rows[i];
                    int     index = 0;
                    Costume store = new Costume();
                    try
                    {
                        if (!ImportValidate(row))
                        {
                            //款号 商品名称    颜色名称(使用逗号分隔)	吊牌价 成本价 售价 品牌  供应商名称 年份  季节 类别编码    尺码组名称 含有的尺码(使用逗号分隔)	备注

                            store.ID            = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Name          = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Colors        = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Price         = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.CostPrice     = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.SalePrice     = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.EmOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.PfOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.BrandName     = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SupplierName  = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Year          = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.Season        = CommonGlobalUtil.ConvertToString(row[index++]);
                            // Image image =(Image) row[index++];

                            // store.ClassCode = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.BigClass      = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SmallClass    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SubSmallClass = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SizeGroupName = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SizeNames     = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Remarks       = CommonGlobalUtil.ConvertToString(row[index++]);
                            //图片放最后面
                            index++;
                            int curRow = i + 2;
                            if (String.IsNullOrEmpty(store.ID) || String.IsNullOrEmpty(store.Name) || String.IsNullOrEmpty(store.Colors) || String.IsNullOrEmpty(store.SizeGroupName) || String.IsNullOrEmpty(store.SizeNames))
                            {
                                //必填项为空
                                // emptyStore.Add(store);
                                NoNullRows.Add(curRow);
                                continue;
                            }
                            else
                            {
                                /* if (store.ID.Length > 50 || store.Name.Length > 50)
                                 * {
                                 *   ErrorIdOrName.Add(curRow);
                                 *   continue;
                                 * }*/
                                //判断尺码组以及尺码是否格式正确 CommonGlobalCache.SizeGroupList
                                List <SizeGroup> SizeGroupList = CommonGlobalCache.SizeGroupList;

                                int isNoGName = 0;
                                foreach (var sGroup in SizeGroupList)
                                {
                                    if (sGroup.ShowName == store.SizeGroupName)  //尺码组名称存在
                                    {
                                        //判断尺码格式是否正确  M,S,XL
                                        //sGroup.NameOfF
                                        String[] tempSizeList = store.SizeNames.Split(',');
                                        if (tempSizeList != null)
                                        {
                                            bool isRight = true; //当前尺码是否格式完全正确
                                            for (int t = 0; t < tempSizeList.Length; t++)
                                            {
                                                if (tempSizeList[t] == sGroup.NameOfF || tempSizeList[t] == sGroup.NameOfL ||
                                                    tempSizeList[t] == sGroup.NameOfM || tempSizeList[t] == sGroup.NameOfS ||
                                                    tempSizeList[t] == sGroup.NameOfXL || tempSizeList[t] == sGroup.NameOfXL2 ||
                                                    tempSizeList[t] == sGroup.NameOfXL3 || tempSizeList[t] == sGroup.NameOfXL4 ||
                                                    tempSizeList[t] == sGroup.NameOfXL5 || tempSizeList[t] == sGroup.NameOfXL6 ||
                                                    tempSizeList[t] == sGroup.NameOfXS)
                                                {
                                                    //逗号分隔后当前尺码跟数据库尺码匹配
                                                }
                                                else
                                                {
                                                    isRight = false; //当前含有的尺码有错误的格式
                                                    ErrorSizeRows.Add(curRow);
                                                    continue;
                                                }
                                            }
                                            if (isRight == false)
                                            {
                                                continue; //跳出循环,正确的尺码组没有正确的尺码
                                            }
                                        }
                                        else
                                        {
                                            ErrorSizeRows.Add(curRow);   //格式不正确,没有尺码
                                        }
                                    }
                                    else
                                    {
                                        isNoGName++;
                                        if (isNoGName == SizeGroupList.Count)
                                        {
                                            ErrorGroupNameRows.Add(curRow);   //尺码组不存在,格式不正确
                                        }
                                    }
                                }

                                //判断是否重复款号
                                if (stores.Find(t => t.ID == store.ID) != null)
                                {
                                    IDRepeatRows.Add(curRow);
                                    continue;
                                }

                                stores.Add(store);
                            }
                        }
                    }
                    //catch (IOException ex)
                    //{
                    //    ShowMessage(ex.Message);
                    //}
                    catch (Exception ex)
                    {
                    }
                }
                #endregion


                #region  //数据检验
                if (NoNullRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in NoNullRows)
                    {
                        str += "第" + item + "行\r\n";
                    }
                    ShowError("必填项没有填写,请补充完整!\r\n" + str);
                    return;
                }
                if (ErrorIdOrName.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in ErrorGroupNameRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("款号超过50个字符或商品名称超过50个汉字,请检查列表信息!\r\n" + str);
                    return;
                }
                if (IDRepeatRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in IDRepeatRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("重复的款号,系统已过滤,详见错误报告!\r\n" + str);
                    //  return;
                }

                if (ErrorGroupNameRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in ErrorGroupNameRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("尺码组不存在,请检查列表信息!\r\n" + str);
                    return;
                }

                if (ErrorSizeRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in ErrorSizeRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("尺码不存在或尺码格式错误,请检查列表信息!\r\n" + str);
                    return;
                }

                if (stores != null && stores.Count > 0)
                {
                    if (stores.Count == listPhoto.Count)
                    {
                    }
                    else
                    {
                        if (GlobalMessageBox.Show("导入的数据和图片不对应,如果导入会影响到导入的图片与款号不对应,是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    ShowMessage("没有数据可以导入,请检查列表信息!");
                    return;
                }

                #endregion

                path = null;


                #region  //数据录入
                InteractResult result = GlobalCache.ServerProxy.ImportCostumes(stores);
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                case ExeResult.Success:
                    foreach (var item in stores)
                    {
                        Costume costume = CommonGlobalCache.GetCostume(item.ID);
                        if (costume != null)
                        {
                            //重新给商品名称
                            //ShowMessage(item.ID);
                            item.Name = costume.Name;
                        }
                    }

                    for (int i = 0; i < stores.Count; i++)
                    {
                        if (listPhoto.Count > 0 && listPhoto.Count > i)
                        {
                            listPhoto[i].CostumeID = stores[i].ID;

                            //这里还是要给新图片名称,下面取回来对应过去。才有LINKADDRESS
                            PhotoData para = new PhotoData()
                            {
                                Datas          = listPhoto[i].Bytes,
                                EmCostumePhoto = listPhoto[i],
                                Name           = listPhoto[i].PhotoName,
                            };
                            GlobalCache.ServerProxy.UploadPhotoToCos(para);

                            /* GlobalCache.ServerProxy.UploadCostumePhoto(new UploadCostumePhotoPara()
                             * {
                             *
                             *   ID = stores[i].ID,
                             *   Photo = listPhoto[i].Photo,
                             *
                             * });*/
                        }
                    }
                    // AddItems4Display(stores);

                    ShowMessage("导入成功!");
                    break;

                default:
                    break;
                }

                #endregion
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
コード例 #31
0
ファイル: Main.cs プロジェクト: Ragzouken/kooltool-rekindle
    private Costume NewSimpleCostume(Project project)
    {
        var rect = new IntRect(0, 0, 64, 64);

        var texture = project.CreateTexture(64, 64);
        texture.SetPixels(new IntRect(16, 16, 32, 32), test.GetPixels(new IntRect(0, 64, 32, 32)));
        texture.Apply();

        var spr = new KoolSprite(texture, new IntRect(0, 0, 64, 64), IntVector2.one * 32);

        var costume = new Costume
        {
            right = spr,
            down  = spr,
            left  = spr,
            up    = spr,
        };

        return costume;
    }
コード例 #32
0
 public Costume Update(Costume costume)
 {
     this.Delete(costume.Id);
     return(this.Create(costume));
 }
コード例 #33
0
 // Set the target sprite sheet to a costume type sent from above
 public void SetSprite(Costume costume)
 {
     spriteSheetName = costume;
     subSprites = Resources.LoadAll <Sprite> ("NPC/" + spriteSheetName.ToString ());
 }
コード例 #34
0
 public Hero(string name, Powers power)
 {
     this.Name         = name;
     this.superCostume = new Costume(power);
     this.Punchline    = String.Format("My name is {0}, my super power is {1} and I will save the world !!!", name, power);
 }