Esempio n. 1
0
        /////////////////////////////////////////////////////////////////////

        public string getShipImgName(string shipID, ShipImageType type)
        {
            var    shipinfo = (from ship in gameinfo["userShipVO"] where ship["id"].ToString() == shipID select ship).First();
            string shipModel;

            if (shipinfo["skin_cid"].ToString() != "0")
            {
                shipModel = (from skin in init_txt["ShipSkin"] where skin["cid"].ToString() == shipinfo["skin_cid"].ToString() select skin["skinId"].ToString()).First();
            }
            else
            {
                shipModel = (from ship in init_txt["shipCard"] where ship["cid"].ToString() == shipinfo["shipCid"].ToString() select ship["picId"].ToString()).First();
            }
            if (double.Parse((string)shipinfo["battleProps"]["hp"]) <= Math.Ceiling(double.Parse((string)shipinfo["battlePropsMax"]["hp"]) / 2))
            {
                shipModel = "BROKEN_" + shipModel;
            }
            else
            {
                shipModel = "NORMAL_" + shipModel;
            }
            switch (type)
            {
            case ShipImageType.L:
                shipModel = @"documents\hot\ccbResources\model\L_" + shipModel;
                break;

            case ShipImageType.M:
                shipModel = @"documents\hot\ccbResources\model\M_" + shipModel;
                break;

            case ShipImageType.S:
                shipModel = @"documents\hot\ccbResources\model\S_" + shipModel;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
            return(shipModel);
        }
 public Image getShipImage(string shipID, ShipImageType type, bool hasBG)
 {
     return(imageFinder.getImage(getShipImgName(shipID, type)));
 }