Beispiel #1
0
  public DoublePeakRoof (BuildingMesh parent)
    : base(parent)
  {
    width = 0.2f;
    boundaries = new Vector3[6];

    for (int i = 0; i < 4; ++i)
      boundaries[i] = parentMesh.roofBase.boundaries[i + 4]+
                      width * parentMesh.faces[i].normal +
                      width * parentMesh.faces[(i + 3) % 4].normal;

    FindMeshOrigin(boundaries[0], boundaries[2],
                   boundaries[1], boundaries[3]);

    int index = Mathf.Max(parentMesh.sortedFaces[2], parentMesh.sortedFaces[3]);
    Face face = parentMesh.faces[index];
    height = 0.2f * face.width;
    var bi0 = (parentMesh.faces[(index + 3) % 4].right - face.right).normalized;
    var bi1 = (face.right - parentMesh.faces[(index + 1) % 4].right).normalized;
    var p = Util.IntersectionPoint(face.boundaries[0], bi0, face.boundaries[1], bi1);

    boundaries[4] = new Vector3(p.x,
                                boundaries[0].y + height,
                                p.z);

    index = Mathf.Min(parentMesh.sortedFaces[2], parentMesh.sortedFaces[3]);
    face = parentMesh.faces[index];
    bi0 = (parentMesh.faces[(index + 3) % 4].right - face.right).normalized;
    bi1 = (face.right - parentMesh.faces[(index + 1) % 4].right).normalized;
    p = Util.IntersectionPoint(face.boundaries[0], bi0, face.boundaries[1], bi1);

    boundaries[5] = new Vector3(p.x,
                                boundaries[0].y + height,
                                p.z);

    if ((boundaries[0] - boundaries[4]).magnitude <
        (boundaries[0] - boundaries[5]).magnitude)
    {
      _type = _Type.four;
      _widthBig = (boundaries[0] - boundaries[1]).magnitude;
      _widthSmall = (boundaries[1] - boundaries[2]).magnitude;
      _heightSmall = ((boundaries[1] + boundaries[2]) / 2 - boundaries[5]).magnitude;
    }
    else
    {
      _type = _Type.five;
      _widthBig = (boundaries[1] - boundaries[2]).magnitude;
      _widthSmall = (boundaries[1] - boundaries[0]).magnitude;
      _heightSmall = ((boundaries[1] + boundaries[0]) / 2 - boundaries[5]).magnitude;
    }

    _heightBig = Mathf.Sqrt(Mathf.Pow(_widthSmall / 2, 2) +
                            Mathf.Pow(height, 2));
  }
Beispiel #2
0
    /// <summary>
    /// 해당 type Buff를 owner가 가지고 있는 지 알려준다.
    /// </summary>
    /// <param name="owner">어떠한 유닛이</param>
    /// <param name="type">무슨 버프를 가지고 있는 지</param>
    /// <returns>해당 owner가 type 버프를 가지고 있으면 true를 리턴.</returns>
    public static bool HasBuff(Unit owner, _Type type)
    {
        foreach (var crowdControl in owner.CrowdControlGroup)
        {
            if (crowdControl.Type == type)
            {
                return(true);
            }
        }

        return(false);
    }
Beispiel #3
0
        public virtual ConcreteMixinTypeIdentifier GetIdentifierForMixinType(_Type concreteMixinType)
        {
            ArgumentUtility.CheckNotNull("concreteMixinType", concreteMixinType);

            var attribute =
                (ConcreteMixinTypeAttribute)concreteMixinType.GetCustomAttributes(typeof(ConcreteMixinTypeAttribute), false).SingleOrDefault();

            if (attribute != null)
            {
                return(attribute.GetIdentifier());
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        public virtual ClassContext GetMetadataForMixedType(_Type concreteMixedType)
        {
            ArgumentUtility.CheckNotNull("concreteMixedType", concreteMixedType);

            var attribute =
                (ConcreteMixedTypeAttribute)concreteMixedType.GetCustomAttributes(typeof(ConcreteMixedTypeAttribute), false).SingleOrDefault();

            if (attribute != null)
            {
                return(attribute.GetClassContext());
            }
            else
            {
                return(null);
            }
        }
        public PartySalesSummary(_Type type)
        {
            InitializeComponent();
            this.FitToHorazonal();
            mType = type;
            if (cmbCustomerName.Items.Count > 0)
            {
                if (cmbCustomerName.DataSource != null)
                {
                    cmbCustomerName.DataSource = null;
                }
                else
                {
                    cmbCustomerName.Items.Clear();
                }
            }
            switch (mType)
            {
            case _Type.Item:
                rbtnSales.Checked = true;
                InitSalesReportItemWiseDataTable();
                lblHeader.Text = "Item Summary";
                mExcelFileName = "Item_Summary.xls";
                cmbCustomerName.AddItem();
                if (cmbCustomerName.Items.Count > 0)
                {
                    cmbCustomerName.SelectedIndex = 0;
                }
                break;

            case _Type.Party:
                rbtnSales.Visible    = false;
                rbtnPurchase.Visible = false;
                InitSalesReportPartyWiseDataTable();
                lblHeader.Text = "Sales Summary [Party Wise]";
                mExcelFileName = "Party_Summary.xls";
                cmbCustomerName.AddCashCustomers();
                if (cmbCustomerName.Items.Count > 0)
                {
                    cmbCustomerName.SelectedIndex = 0;
                }
                break;

            default:
                break;
            }
        }
Beispiel #6
0
 public SData_Type(string dataname)
 {
     try
     {
         string[] reader   = File.ReadAllLines(Application.dataPath + "\\MapEditor\\MapTypeData\\" + dataname);
         int      rowCount = reader.Length;
         for (int row = 0; row < rowCount; row++)
         {
             _Type tpInfo = new _Type(reader, row);
             Data.Add(new KeyValuePair <int, string>(tpInfo.ID, tpInfo.Type));
         }
     }
     catch (Exception e)
     {
         Debug.LogError("装载 Type 错误" + e);
     }
 }
Beispiel #7
0
        /// <summary>
        /// Read Bink video offset and size
        /// </summary>
        /// <param name="br">Binary reader</param>
        /// <param name="type">Header of file type</param>
        private FileSection ReadBIK(BinaryReader br, _Type type)
        {
            br.BaseStream.Seek(-1, SeekOrigin.Current);
            byte version = br.ReadByte();

            if ((type == _Type.BIK && bik1.Contains(version)) || (type == _Type.KB2 && bik2.Contains(version)))
            {
            }
            else
            {
                throw new Exception($"_Type {type}, version {version}, is invalid");
            }
            FileSection fs = new FileSection()
            {
                _Type  = type,
                Offset = br.BaseStream.Position - 4,
                Size   = br.ReadUInt32() + 8,
                Frames = br.ReadUInt32()
            };

            br.BaseStream.Seek(fs.Offset + fs.Size, SeekOrigin.Begin);

            if (movie.BINK_HIGH == null)
            {
                movie.BINK_HIGH          = fs;
                movie.BINK_HIGH.FileName = GenerateFileName(movie.BINK_HIGH._Type == _Type.BIK ? "bik" : "bk2", "h");
            }
            else
            {
                if (fs.Size > movie.BINK_HIGH.Size)
                {
                    movie.BINK_LOW  = movie.BINK_HIGH;
                    movie.BINK_HIGH = fs;
                }
                else
                {
                    movie.BINK_LOW = fs;
                }

                movie.BINK_HIGH.FileName = GenerateFileName(movie.BINK_LOW._Type == _Type.BIK ? "bik" : "bk2", "h");
                movie.BINK_LOW.FileName  = GenerateFileName(movie.BINK_LOW._Type == _Type.BIK ? "bik" : "bk2", "l");
                _movies.Add(movie);
                movie = new MovieClip();
            }
            return(fs);
        }
Beispiel #8
0
 /// <summary>
 /// Read complete pak file for offsets and sizes of each section.
 /// </summary>
 /// <param name="info">File path info</param>
 private void Read(FileInfo info)
 {
     FilePath = info;
     using (BinaryReader br = new BinaryReader(File.OpenRead(info.FullName)))
     {
         movie = new MovieClip();
         while (br.BaseStream.Position < br.BaseStream.Length)
         {
             _Type header = (_Type)(br.ReadUInt32() & (uint)_Type._3B_MASK);
             if (ReadFunctions.ContainsKey(header))
             {
                 ReadFunctions[header](br, header);
             }
             else
             {
                 throw new Exception($"{header} is invalid, reading from: {info}, offset {br.BaseStream.Position}");
             }
         }
     }
 }
Beispiel #9
0
    public static Buff CreateBuff(Unit owner, _ParentType parentType, _Type type, int lifespan, bool isPositive)
    {
        var buff = Instantiate();

        buff.Initialize();
        buff.ParentType = parentType;
        buff.Type       = type;
        buff.Lifespan   = lifespan;
        buff.IsPositive = isPositive;
        buff.Owner      = owner;

        if (buff.Owner == null)
        {
            return(null);
        }

        buff.BuffArgs = new BuffArgs().SetOwner(buff.Owner);

        buff.OnBirth();

        return(buff);
    }
Beispiel #10
0
        /// <summary>
        /// Read cam file offset and size
        /// </summary>
        /// <param name="br">Binary reader</param>
        /// <param name="type">Header of file type</param>
        private FileSection ReadCAM(BinaryReader br, _Type type)
        {
            long offset = br.BaseStream.Position - 4;  // start of section

            br.BaseStream.Seek(2, SeekOrigin.Current); // skip 2 bytes
            ushort frames = br.ReadUInt16();           // get approx number of frames

            br.BaseStream.Seek((frames) * CamSectionSize, SeekOrigin.Current);
            uint b = 0;

            // there seems to be 1 or more extra frames. Check for those.
            while ((b = br.ReadUInt32()) > 0 && !(((_Type)(b & (uint)_Type._3B_MASK)) == _Type.BIK || ((_Type)(b & (uint)_Type._3B_MASK)) == _Type.KB2))
            {
                br.BaseStream.Seek(CamSectionSize - sizeof(uint), SeekOrigin.Current);
                frames++;
            }
            // Found the end go back to it.
            br.BaseStream.Seek(-sizeof(uint), SeekOrigin.Current);

            // There is only one cam per movie. Checking for possibility of only one video instead of the normal 2 per movie.
            if (movie.CAM != null)
            {
                if (!_movies.Contains(movie))
                {
                    //add existing movie to movies list.
                    _movies.Add(movie);
                }
                //start from scratch
                movie = new MovieClip();
            }

            FileSection fs = new FileSection()
            {
                _Type = type, Offset = offset, Size = br.BaseStream.Position - offset, Frames = frames, FileName = GenerateFileName("cam")
            };

            movie.CAM = fs;
            return(fs);
        }
        public Sales_OrderItemSummary(_Type type)
        {
            InitializeComponent();
            this.FitToHorazonal();
            mType = type;
            switch (mType)
            {
            case _Type.Order:
                InitOrderDataTable();
                lblHeader.Text = "Order Summary";
                mExcelFileName = "Order_Summary.xls";
                break;

            case _Type.Sales:
                InitSalesDataTable();
                lblHeader.Text = "Sales Summary";
                mExcelFileName = "Sales_Summary.xls";

                break;

            default:
                break;
            }
        }
Beispiel #12
0
 public Breathing(_Type type, NativeWin32.ColorRef color1, NativeWin32.ColorRef color2)
 {
     Type   = type;
     Color1 = color1;
     Color2 = color2;
 }
 public void isExit()
 {
     type = _Type.Exit;
     StartCoroutine(loadAnimation());
     Destroy(gameObject);
 }
Beispiel #14
0
 public void isNo()
 {
     type = _Type.No;
     StartCoroutine(loadAnimation());
 }
Beispiel #15
0
 public void isExit()
 {
     type = _Type.Exit;
     StartCoroutine(loadAnimation());
 }
Beispiel #16
0
 public Command(_Type a)
 {
     command_type = a;
 }
Beispiel #17
0
 public void isYes()
 {
     type = _Type.Yes;
     StartCoroutine(loadAnimation());
 }
        public void CreateProduct(dynamic ProductDetails)
        {
            dynamic ProductDetailsJSON = JsonConvert.DeserializeObject(ProductDetails.ToString());

            int _categoryId;
            int _brandId;
            int _collectionId;
            int _typeid;

            ///////////////CATEGORY////////////////
            dynamic c = 1;

            if (ProductDetailsJSON.CategoryId != null)
            {
                int category = ProductDetailsJSON.CategoryId;
                c = _context.Categories.Find(category);
            }
            if (c == null || ProductDetailsJSON.CategoryId == null)
            {
                Category _Category = new Category()
                {
                    Id           = _context.Categories.Select(a => a.Id).Max() + 1,
                    CategoryName = ProductDetailsJSON.CategoryName
                };
                _context.Categories.Add(_Category);
                _categoryId = _Category.Id;
                //_context.SaveChanges();
            }
            else
            {
                _categoryId = ProductDetailsJSON.CategoryId;
            }

            ///////////////TYPE////////////////
            dynamic t = 1;

            if (ProductDetailsJSON.TypeId != null)
            {
                int type = ProductDetailsJSON.TypeId;
                t = _context.Types.Find(type);
            }
            if (t == null || ProductDetailsJSON.TypeId == null)
            {
                _Type _Type = new _Type()
                {
                    Id        = _context.Types.Select(a => a.Id).Max() + 1,
                    _TypeName = ProductDetailsJSON.TypeName
                };
                _context.Types.Add(_Type);
                _typeid = _Type.Id;

                Category_Type CT = new Category_Type()
                {
                    CategoryId = _categoryId,
                    _TypeId    = _typeid
                };
                _context.CategoryType.Add(CT);
            }
            else
            {
                _typeid = ProductDetailsJSON.TypeId;
            }

            ///////////////BRAND////////////////
            dynamic b = 1;

            if (ProductDetailsJSON.BrandId != null)
            {
                int brand = ProductDetailsJSON.BrandId;
                b = _context.Brands.Find(brand);
            }
            if (b == null || ProductDetailsJSON.BrandId == null)
            {
                Brand Brand = new Brand()
                {
                    Id        = _context.Brands.Select(a => a.Id).Max() + 1,
                    BrandName = ProductDetailsJSON.BrandName
                };
                _context.Brands.Add(Brand);
                _brandId = Brand.Id;
                //_context.SaveChanges();
            }
            else
            {
                _brandId = ProductDetailsJSON.BrandId;
            }

            ///////////////Collection////////////////
            dynamic co = 1;

            if (ProductDetailsJSON.CollectionId != null)
            {
                int coll = ProductDetailsJSON.CollectionId;
                co = _context.Collections.Find(coll);
            }
            if (co == null || ProductDetailsJSON.CollectionId == null)
            {
                Collection Collection = new Collection()
                {
                    Id             = _context.Collections.Select(a => a.Id).Max() + 1,
                    BrandId        = _brandId,
                    CollectionName = ProductDetailsJSON.CollectionName
                };
                _context.Collections.Add(Collection);
                _collectionId = Collection.Id;
            }
            else
            {
                _collectionId = ProductDetailsJSON.CollectionId;
            }

            ///////////////STOCK////////////////
            Stock Stock = new Stock()
            {
                //Id = ProductDetailsJSON.StockId,
                Id = _context.Stock.Select(a => a.Id).Max() + 1,
                ProductQuantity = ProductDetailsJSON.Stock
            };

            _context.Stock.Add(Stock);

            ///////////////PRODUCT////////////////
            Product Product = new Product()
            {
                ProductName          = ProductDetailsJSON.ProductName,
                _TypeId              = _typeid,       //ProductDetailsJSON.TypeId,
                CategoryId           = _categoryId,   //ProductDetailsJSON.CategoryId,
                CollectionId         = _collectionId, //ProductDetailsJSON.CollectionId,
                BrandId              = _brandId,      //ProductDetailsJSON.BrandId,
                StockId              = Stock.Id,      //ProductDetailsJSON.StockId,
                Id                   = _context.Products.Select(a => a.Id).Max() + 1,
                ProductNumber        = ProductDetailsJSON.ProductNumber,
                ProductEAN           = ProductDetailsJSON.ProductEAN,
                ProductInfo          = ProductDetailsJSON.ProductInfo,
                ProductDescription   = ProductDetailsJSON.ProductDescription,
                ProductSpecification = ProductDetailsJSON.ProductSpecification,
                ProductPrice         = ProductDetailsJSON.ProductPrice,
                ProductColor         = ProductDetailsJSON.ProductColor,
            };

            _context.Products.Add(Product);

            ///////////////IMAGE////////////////
            // ProductImage ProductImage = new ProductImage()
            // {
            //     ProductId = Product.Id,
            //     ImageURL = ProductDetailsJSON.ImageURL,
            //     //Id = ProductDetailsJSON.ImageId
            //     Id = _context.ProductImages.Select(a => a.Id).Max() + 1,
            // };
            // _context.ProductImages.Add(ProductImage);

            _context.SaveChanges();
        }
Beispiel #19
0
 private FileSection ReadKB2(BinaryReader br, _Type header) => ReadBIK(br, header);
        public void UpdateProduct(dynamic U_product, int id)
        {
            dynamic U_product_JSON = JsonConvert.DeserializeObject(U_product.ToString());
            Product p = _context.Products.Find(id);

            if (U_product_JSON.ProductName != null)
            {
                p.ProductName = U_product_JSON.ProductName;
            }
            if (U_product_JSON.ProductEAN != null)
            {
                p.ProductEAN = U_product_JSON.ProductEAN;
            }
            if (U_product_JSON.ProductNumber != null)
            {
                p.ProductNumber = U_product_JSON.ProductNumber;
            }
            if (U_product_JSON.ProductInfo != null)
            {
                p.ProductInfo = U_product_JSON.ProductInfo;
            }
            if (U_product_JSON.ProductDescription != null)
            {
                p.ProductDescription = U_product_JSON.ProductDescription;
            }
            if (U_product_JSON.ProductSpecification != null)
            {
                p.ProductSpecification = U_product_JSON.ProductSpecification;
            }
            if (U_product_JSON.ProductPrice != null)
            {
                p.ProductPrice = U_product_JSON.ProductPrice;
            }
            if (U_product_JSON.ProductColor != null)
            {
                p.ProductColor = U_product_JSON.ProductColor;
            }
            if (U_product_JSON._TypeId != null)
            {
                p._TypeId = U_product_JSON._TypeId;
            }
            if (U_product_JSON.CategoryId != null)
            {
                p.CategoryId = U_product_JSON.CategoryId;
            }
            if (U_product_JSON.CollectionId != null)
            {
                p.CollectionId = U_product_JSON.CollectionId;
            }
            if (U_product_JSON.BrandId != null)
            {
                p.BrandId = U_product_JSON.BrandId;
            }
            _context.Update(p);
            Stock s = _context.Stock.Find(p.StockId);

            if (U_product_JSON.ProductQuantity != null)
            {
                s.ProductQuantity = U_product_JSON.ProductQuantity;
            }
            _context.Update(s);
            if (U_product_JSON._TypeId != null)
            {
                int   TId = U_product_JSON._TypeId;
                _Type t   = _context.Types.Find(TId);
                if (U_product_JSON._TypeName != null)
                {
                    t._TypeName = U_product_JSON._TypeName;
                }
                _context.Update(t);
            }
            if (U_product_JSON.CollectionId != null)
            {
                int        CId = U_product_JSON.CollectionId;
                Collection c   = _context.Collections.Find(CId);
                if (U_product_JSON.CollectionName != null)
                {
                    c.CollectionName = U_product_JSON.CollectionName;
                }
                _context.Update(c);
            }
            if (U_product_JSON.CategoryId != null)
            {
                int      CatId = U_product_JSON.CategoryId;
                Category cat   = _context.Categories.Find(CatId);
                if (U_product_JSON.CategoryId != null)
                {
                    cat.CategoryName = U_product_JSON.CategoryName;
                }
                _context.Update(cat);
            }
            if (U_product_JSON.BrandId != null)
            {
                int   BId = U_product_JSON.BrandId;
                Brand b   = _context.Brands.Find(BId);
                if (U_product_JSON.BrandId != null)
                {
                    b.BrandName = U_product_JSON.BrandName;
                }
                _context.Update(b);
            }
            int          IId = _context.ProductImages.First(a => a.ProductId == id).Id;
            ProductImage i   = _context.ProductImages.Find(IId);

            if (U_product_JSON.ImageURL != null)
            {
                i.ImageURL = U_product_JSON.ImageURL;
            }
            _context.Update(i);
            _context.SaveChanges();
        }
Beispiel #21
0
        public virtual Dictionary <MethodInfo, MethodInfo> GetMethodWrappersForMixinType(_Type concreteMixinType)
        {
            ArgumentUtility.CheckNotNull("concreteMixinType", concreteMixinType);
            var wrappers = from potentialWrapper in concreteMixinType.GetMethods(BindingFlags.Instance | BindingFlags.Public)
                           let wrappedMethod = GetWrappedMethod(potentialWrapper)
                                               where wrappedMethod != null
                                               select new { Method = wrappedMethod, Wrapper = potentialWrapper };

            return(wrappers.ToDictionary(pair => pair.Method, pair => pair.Wrapper));
        }
 public void isYes()
 {
     // do somthing
     type = _Type.Yes;
     StartCoroutine(loadAnimation());
 }