示例#1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            VH vh = holder as VH;

            vh.imgDesc.SetImageResource(mSearchResults[position].imgResId);
            vh.tvTitle.Text    = mSearchResults[position].title;
            vh.tvAddress.Text  = mSearchResults[position].address;
            vh.tvPhone.Text    = mSearchResults[position].phone;
            vh.tvDistance.Text = mSearchResults[position].distance;
            if (mSearchResults[position].isFav)
            {
                vh.imgFav.SetImageResource(Resource.Mipmap.star_select);
            }
            else
            {
                vh.imgFav.SetImageResource(Resource.Mipmap.star);
            }
            vh.imgFav.Click += (o, e) => {
                if (holder.AdapterPosition < 0)
                {
                    return;
                }
                mSearchResults[holder.AdapterPosition].isFav = !mSearchResults[holder.AdapterPosition].isFav;
                NotifyDataSetChanged();
            };
        }
示例#2
0
文件: PolygonData.cs 项目: Arnyev/GK
 public void GetRelations(int index, out VH verticalHorizontal, out int maxSize, out int currentDistance)
 {
     currentDistance =
         _basicCalculator.EuclideanDistance(_points[index], _points[(index + 1) % _currentPointCount]);
     verticalHorizontal = _verticalHorizontals[index];
     maxSize            = _maxSizes[index];
 }
示例#3
0
        private VAB FindLinkedVAB()
        {
            VH vh = FindLinkedVH();

            SampleLine[] vb = FindLinkedVB();
            return(VAB.Join(vh, vb));
        }
示例#4
0
        private void Menu_Export_Linked_VH()
        {
            VH vh = FindLinkedVH();

            byte[] data = vh.Save();
            FileUtil.SaveFile(data, FileFilters.VH, FileFilters.Any);
        }
示例#5
0
文件: Ocean.cs 项目: mokefyni/Water
        protected void UpdateParams()
        {
            position = transform.position.y;
            scaleSum = VH.Sum(waveScales);

            // Update wave function animation
            Vector4 wAngle = (Vector4.one * windAngle + waveAngles) * Mathf.Deg2Rad;

            waveDirection01         = new Vector4(Mathf.Cos(wAngle.x), Mathf.Sin(wAngle.x), Mathf.Cos(wAngle.y), Mathf.Sin(wAngle.y));
            waveDirection23         = new Vector4(Mathf.Cos(wAngle.z), Mathf.Sin(wAngle.z), Mathf.Cos(wAngle.w), Mathf.Sin(wAngle.w));
            waveOffsets            += waveSpeeds * Time.deltaTime;
            waveConstants           = VH.Div(Vector4.one * (2.0f * Mathf.PI), waveLengths);
            waveDerivativeConstants = 0.5f * VH.Mul(VH.Mul(waveScales, waveConstants), waveExponents);

            // Update texture animations
            float nAngle0 = (windAngle + normalMapAngle0) * Mathf.Deg2Rad;
            float nAngle1 = (windAngle + normalMapAngle1) * Mathf.Deg2Rad;

            normalMapOffset0 += new Vector2(Mathf.Cos(nAngle0), Mathf.Sin(nAngle0)) * normalMapSpeed0 * Time.deltaTime;
            normalMapOffset1 += new Vector2(Mathf.Cos(nAngle1), Mathf.Sin(nAngle1)) * normalMapSpeed1 * Time.deltaTime;

            float fAngle = (windAngle + foamMapAngle) * Mathf.Deg2Rad;

            foamMapOffset += new Vector2(Mathf.Cos(fAngle), Mathf.Sin(fAngle)) * foamMapSpeed * Time.deltaTime;
        }
示例#6
0
        internal void ParseParam(List <XParam> paras)
        {
            //
            if (paras == null)
            {
                paras = new List <XParam>();
            }

            //
            DPH.ResetParameter();
            foreach (var p in paras)
            {
                //
                p.ParamName = p.ParamName.Replace(XSQL.QuestionMark.ToString(), "").Replace(XSQL.At.ToString(), "");

                //
                if (p.ParamType == ParamTypeEnum.None &&
                    p.ParamValue != null)
                {
                    var type = p.ParamValue.GetType();
                    if (type.IsEnum)
                    {
                        type = Enum.GetUnderlyingType(type);
                    }
                    else if (type.IsNullable())
                    {
                        type = Nullable.GetUnderlyingType(type);
                    }

                    if (XConfig.DefaultParamTypes.TryGetValue(type, out var func))
                    {
                        p.ParamType = func(DB);
                    }
                    else
                    {
                        throw XConfig.EC.Exception(XConfig.EC._012, $"请为参数【{p.ParamName}】指定【XParam.ParamType】类型 !");
                    }
                }

                //
                if (p.ParamDirection == ParamDirectionEnum.None)
                {
                    p.ParamDirection = ParamDirectionEnum.Input;
                }

                //
                DPH.AddParameter(new DicParam
                {
                    Crud       = CrudEnum.SQL,
                    Action     = ActionEnum.SQL,
                    Param      = p.ParamName,
                    ParamRaw   = p.ParamName,
                    CsValue    = p.ParamValue,
                    CsValueStr = p.ParamValue == null ? string.Empty : VH.ValueProcess(p.ParamValue, p.ParamValue.GetType(), string.Empty),
                    CsType     = p.ParamValue == null ? default(Type) : p.ParamValue.GetType(),
                    ParamUI    = p
                });
            }
            DPH.SetParameter();
        }
示例#7
0
 private void Menu_Replace_VH()
 {
     byte[] data = FileUtil.OpenFile(FileFilters.VH, FileFilters.Any);
     if (data != null)
     {
         vh = VH.Load(data);
         oldmusicentrycontroller.OldMusicEntry.VH = vh;
     }
 }
示例#8
0
        public float GetHeightAt(Vector3 point)
        {
            Vector2 xz        = VH.GetXZ(point);
            Vector4 locations = new Vector4(Vector2.Dot(VH.GetXY(waveDirection01), xz), Vector2.Dot(VH.GetZW(waveDirection01), xz), Vector2.Dot(VH.GetXY(waveDirection23), xz), Vector2.Dot(VH.GetZW(waveDirection23), xz));
            Vector4 sine      = VH.Sin(VH.Mul((locations + waveOffsets), waveConstants)) * 0.5f + new Vector4(0.5f, 0.5f, 0.5f, 0.5f);
            float   sum       = Vector4.Dot(waveScales, VH.Pow(sine, waveExponents));

            return(position + sum);
        }
示例#9
0
文件: Ocean.cs 项目: mokefyni/Water
        protected void SendParamsToShader()
        {
            if (mat == null ||   !mat.HasProperty("ot_NormalMap0"))
            {
                return;
            }

            Shader.SetGlobalFloat("ot_OceanPosition", position);

            // Wave function animation
            Shader.SetGlobalVector("ot_WaveScales", waveScales);
            Shader.SetGlobalVector("ot_WaveLengths", waveLengths);
            Shader.SetGlobalVector("ot_WaveExponents", waveExponents);
            Shader.SetGlobalVector("ot_WaveOffsets", waveOffsets);
            Shader.SetGlobalVector("ot_WaveDirection01", waveDirection01);
            Shader.SetGlobalVector("ot_WaveDirection23", waveDirection23);
            Shader.SetGlobalVector("ot_WaveConstants", waveConstants);
            Shader.SetGlobalVector("ot_WaveDerivativeConstants", waveDerivativeConstants);

            // Texture animations
            Vector2 normalMapScale0 = mat.GetTextureScale("ot_NormalMap0");
            Vector2 normalMapScale1 = mat.GetTextureScale("ot_NormalMap1");
            Vector2 foamMapScale    = mat.GetTextureScale("ot_FoamMap");

            mat.SetTextureOffset("ot_NormalMap0", VH.Mul(normalMapOffset0, normalMapScale0));
            mat.SetTextureOffset("ot_NormalMap1", VH.Mul(normalMapOffset1, normalMapScale1));
            mat.SetTextureOffset("ot_FoamMap", VH.Mul(foamMapOffset, foamMapScale));

            // General
            Vector3 lightDir = Vector3.up;

            if (sun != null)
            {
                lightDir = -sun.transform.forward;
            }

            Shader.SetGlobalVector("ot_LightDir", lightDir);

            Vector4 dwColorUnlit       = mat.GetColor("ot_DeepWaterColorUnlit");
            float   dwIntensityZenith  = mat.GetFloat("ot_DeepWaterIntensityZenith");
            float   dwIntensityHorizon = mat.GetFloat("ot_DeepWaterIntensityHorizon");
            float   dwIntensityDark    = mat.GetFloat("ot_DeepWaterIntensityDark");

            float dwScalar = 0.0f;

            if (lightDir.y >= 0.0f)
            {
                dwScalar = Mathf.Lerp(dwIntensityHorizon, dwIntensityZenith, lightDir.y);
            }
            else
            {
                dwScalar = Mathf.Lerp(dwIntensityHorizon, dwIntensityDark, -lightDir.y);
            }

            Shader.SetGlobalVector("ot_DeepWaterColor", dwColorUnlit * dwScalar);
        }
示例#10
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.Layout_item_search_result, parent, false);

            // Create a ViewHolder to hold view references inside the CardView:
            VH vh = new VH(itemView);

            return(vh);
        }
示例#11
0
        /// <summary>
        /// Gets the correct BaseFile class by comparing the file with the known header signatures.
        /// </summary>
        /// <param name="filePath">Filepath</param>
        /// <returns></returns>
        public static BaseFile GetTypeFromFile(string filePath)
        {
            byte[] buffer;
            using (BinaryReader reader = new BinaryReader(new FileStream(filePath, FileMode.Open)))
            {
                if (reader.BaseStream.Length < 256)
                {
                    buffer = new byte[reader.BaseStream.Length];
                    reader.Read(buffer, 0, buffer.Length);
                }
                else
                {
                    buffer = new byte[256];
                    reader.Read(buffer, 0, 256);
                }
            }

            if (BG.Compare(buffer))
            {
                return(new BGFile(filePath));
            }
            if (LZB.Compare(buffer))
            {
                return(new LZBFile(filePath));
            }
            if (PACK.Compare(buffer))
            {
                return(new PBFile(filePath));
            }
            if (SEQ.Compare(buffer))
            {
                return(new SEQFile(filePath));
            }
            if (STR.Compare(filePath))
            {
                return(new STRFile(filePath));
            }
            if (TIM.Compare(buffer))
            {
                return(new TIMFile(filePath));
            }
            if (VB.Compare(buffer))
            {
                return(new VBFile(filePath));
            }
            if (VH.Compare(buffer))
            {
                return(new VHFile(filePath));
            }
            if (XA.Compare(filePath))
            {
                return(new XAFile(filePath));
            }
            return(new BaseFile(filePath));
        }
示例#12
0
 public OldVHController(OldMusicEntryController oldmusicentrycontroller, VH vh)
 {
     this.oldmusicentrycontroller = oldmusicentrycontroller;
     this.vh               = vh;
     Node.Text             = "VH";
     Node.ImageKey         = "vh";
     Node.SelectedImageKey = "vh";
     AddMenu("Replace VH", Menu_Replace_VH);
     AddMenuSeparator();
     AddMenu("Export VH", Menu_Export_VH);
 }
示例#13
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            VH vh = holder as VH;

            SimpleDateFormat format = new SimpleDateFormat("hh:mm a");
            String           time   = format.Format(mData[position].date.Time);

            vh.tvTime.Text     = time;
            vh.tvDuration.Text = mData[position].duraion;
            vh.tvName.Text     = mData[position].name;
            vh.tvLocation.Text = mData[position].location;
            vh.tvDesc.Text     = mData[position].desc;
            vh.delete.Click   += (o, e) => {
                if (position > ItemCount - 1)
                {
                    return;
                }
                mData.Remove(mData[position]);
                NotifyDataSetChanged();
                if (mData.Count == 0)
                {
                    mDialog.Dismiss();
                }
            };
            vh.edit.Click += (o, e) =>
            {
                HMEvent data   = mData[position];
                Intent  intent = new Intent(mActivity, typeof(CalendarEditAcitvity));
                intent.PutExtra("title", "Edit event");
                intent.PutExtra("name", data.name);
                intent.PutExtra("date", data.date);
                intent.PutExtra("time", time);
                intent.PutExtra("duration", data.duraion);
                intent.PutExtra("location", data.location);
                intent.PutExtra("desc", data.desc);
                intent.PutExtra("occ", data.occurence.ToString());
                intent.PutExtra("index", position);
                mActivity.StartActivityForResult(intent, EDIT);
            };
            vh.add.Click += (o, e) =>
            {
                Intent intent = new Intent(mActivity, typeof(CalendarEditAcitvity));
                mActivity.StartActivityForResult(intent, ADD);
            };
            if (position == mData.Count - 1)
            {
                vh.add.Visibility = ViewStates.Visible;
            }
            else
            {
                vh.add.Visibility = ViewStates.Gone;
            }
        }
示例#14
0
 private void Menu_Import_VH()
 {
     if (musicentry.VH != null)
     {
         throw new GUIException("This music entry already contains a VH file.");
     }
     byte[] data = FileUtil.OpenFile(FileFilters.VH, FileFilters.VAB, FileFilters.Any);
     if (data != null)
     {
         VH vh = VH.Load(data);
         musicentry.VH = vh;
         InsertNode(0, new VHController(this, vh));
     }
 }
示例#15
0
        ///<summary>
        /// Returns a single repetition of Visiting Hours(LDP-10).
        /// throws HL7Exception if the repetition number is invalid.
        /// <param name="rep">The repetition number (this is a repeating field)</param>
        ///</summary>
        public VH GetVisitingHours(int rep)
        {
            VH ret = null;

            try
            {
                IType t = this.GetField(10, rep);
                ret = (VH)t;
            } catch (System.Exception ex) {
                HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", ex);
                throw new System.Exception("An unexpected error ocurred", ex);
            }
            return(ret);
        }
    private void Start()
    {
        identity = GetComponent <SNet_Identity>();
        info     = new VI(identity.identity);
        vehicle  = new V(identity.identity);
        health   = new VH(identity.identity, maxHealth);

        vehicle.p = new List <ulong>();
        for (int i = 0; i < seatPoints.Count; i++)
        {
            vehicle.p.Add(0);
        }

        MonoBehaviourExtensions.Invoke(this, VehicleUpdate, 3f);
    }
示例#17
0
        /// <summary> Returns a single repetition of Visiting Hours (LDP-10).</summary>
        /// <param name="rep">the repetition number (this is a repeating field)
        /// </param>
        /// <throws>  HL7Exception if the repetition number is invalid. </throws>
        public virtual VH getVisitingHours(int rep)
        {
            VH ret = null;

            try
            {
                Type t = this.getField(10, rep);
                ret = (VH)t;
            }
            catch (System.InvalidCastException)
            {
                throw new Exception();
            }
            return(ret);
        }
示例#18
0
 private Point GetNewPointFromRelation(Point p1, Point p2, VH verticalHorizontal, int maxSize)
 {
     if (verticalHorizontal == VH.Vertical)
     {
         return(new Point(p1.X, p2.Y));
     }
     if (verticalHorizontal == VH.Horizontal)
     {
         return(new Point(p2.X, p1.Y));
     }
     if (maxSize > 0)
     {
         return(ChangeDistance(p1, p2, maxSize));
     }
     return(p2);
 }
示例#19
0
 ///<summary>
 /// Returns all repetitions of Visiting Hours (LDP-10).
 ///</summary>
 public VH[] GetVisitingHours()
 {
     VH[] ret = null;
     try {
         IType[] t = this.GetField(10);
         ret = new VH[t.Length];
         for (int i = 0; i < ret.Length; i++)
         {
             ret[i] = (VH)t[i];
         }
     } catch (HL7Exception he) {
         HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", he);
         throw new System.Exception("An unexpected error ocurred", he);
     } catch (System.Exception cce) {
         HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", cce);
         throw new System.Exception("An unexpected error ocurred", cce);
     }
     return(ret);
 }
示例#20
0
文件: PolygonData.cs 项目: Arnyev/GK
        public void ChangeRelation(int index, VH newRelation)
        {
            if (newRelation == VH.None)
            {
                _verticalHorizontals[index] = newRelation;
                return;
            }
            var nextRelation = _verticalHorizontals[(index + 1) % _currentPointCount];
            var prevRelation = _verticalHorizontals[(index + _currentPointCount - 1) % _currentPointCount];

            if (nextRelation != newRelation && prevRelation != newRelation)
            {
                _verticalHorizontals[index] = newRelation;
            }
            else
            {
                _verticalHorizontals[index] = VH.None;
            }

            Realign(index);
        }
示例#21
0
 /// <summary> Returns all repetitions of Visiting Hours (LDP-10).</summary>
 public virtual VH[] getVisitingHours()
 {
     VH[] ret = null;
     try
     {
         Type[] t = this.getField(10);
         ret = new VH[t.Length];
         for (int i = 0; i < ret.Length; i++)
         {
             ret[i] = (VH)t[i];
         }
     }
     catch (System.InvalidCastException)
     {
         throw new Exception();
     }
     catch (NuGenHL7Exception)
     {
         throw new Exception();
     }
     return(ret);
 }
示例#22
0
        protected void SendParamsToShader()
        {
            if (mat == null || !mat.HasProperty(ot_NormalMap0))
            {
                return;
            }

            Shader.SetGlobalFloat(ot_OceanPosition, position);

            // Wave function animation

            //Shader.SetGlobalVector(ot_WaveScales, waveScales);
            //Shader.SetGlobalVector(ot_WaveLengths, waveLengths);
            //Shader.SetGlobalVector(ot_WaveExponents, waveExponents);
            //Shader.SetGlobalVector(ot_WaveOffsets, waveOffsets);
            //Shader.SetGlobalVector(ot_WaveDirection01, waveDirection01);
            //Shader.SetGlobalVector(ot_WaveDirection23, waveDirection23);
            //Shader.SetGlobalVector(ot_WaveConstants, waveConstants);
            //Shader.SetGlobalVector(ot_WaveDerivativeConstants, waveDerivativeConstants);

            Shader.SetGlobalVector(ot_WorldMove, StreamerManager.GetCurrentMove());

            // Texture animations
            Vector2 normalMapScale0 = mat.GetTextureScale(ot_NormalMap0);

            //Vector2 normalMapScale1 = mat.GetTextureScale(ot_NormalMap1);
            //Vector2 foamMapScale = mat.GetTextureScale(ot_FoamMap);

#if !UNITY_EDITOR
            mat.SetTextureOffset(ot_NormalMap0, VH.Mul(normalMapOffset0, normalMapScale0));
            //mat.SetTextureOffset(ot_NormalMap1, VH.Mul(normalMapOffset1, normalMapScale1));
            //mat.SetTextureOffset(ot_FoamMap, VH.Mul(foamMapOffset, foamMapScale));
#else
            if (Application.isPlaying)
            {
                mat.SetTextureOffset(ot_NormalMap0, VH.Mul(normalMapOffset0, normalMapScale0));
                //mat.SetTextureOffset(ot_NormalMap1, VH.Mul(normalMapOffset1, normalMapScale1));
                //mat.SetTextureOffset(ot_FoamMap, VH.Mul(foamMapOffset, foamMapScale));
            }
#endif

            // General
            Vector3 lightDir = Vector3.up;

            if (sun != null)
            {
                lightDir = -sun.transform.forward;
            }

            Shader.SetGlobalVector(ot_LightDir, lightDir);

            Vector4 dwColorUnlit = mat.GetColor(ot_DeepWaterColorUnlit);
            //float dwIntensityZenith = mat.GetFloat(ot_DeepWaterIntensityZenith);
            //float dwIntensityHorizon = mat.GetFloat(ot_DeepWaterIntensityHorizon);
            //float dwIntensityDark = mat.GetFloat(ot_DeepWaterIntensityDark);

            //float dwScalar = 0.0f;

            //if (lightDir.y >= 0.0f)
            //{
            //    dwScalar = Mathf.Lerp(dwIntensityHorizon, dwIntensityZenith, lightDir.y);
            //}
            //else
            //{
            //    dwScalar = Mathf.Lerp(dwIntensityHorizon, dwIntensityDark, -lightDir.y);
            //}

            //Shader.SetGlobalVector(ot_DeepWaterColor, dwColorUnlit * dwScalar);
            Shader.SetGlobalVector(ot_DeepWaterColor, dwColorUnlit);
        }
示例#23
0
文件: LDP.cs 项目: snosrap/nhapi
 ///<summary>
 /// Returns all repetitions of Visiting Hours (LDP-10).
 ///</summary>
 public VH[] GetVisitingHours()
 {
     VH[] ret = null;
     try {
     IType[] t = this.GetField(10);
     ret = new VH[t.Length];
     for (int i = 0; i < ret.Length; i++) {
     ret[i] = (VH)t[i];
     }
     } catch (HL7Exception he) {
     HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", he);
     throw new System.Exception("An unexpected error ocurred", he);
     } catch (System.Exception cce) {
     HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value.  This is a bug.", cce);
     throw new System.Exception("An unexpected error ocurred", cce);
       }
      return ret;
 }
示例#24
0
        private void DrawLineAndLabel(Graphics graphics, Point p1, Point p2, int maxSize, VH verticalHorizontal,
                                      Bitmap bitmap)
        {
            BresenhamDrawer.DrawLine(p1, p2, bitmap);

            if (maxSize > 0)
            {
                graphics.DrawString(maxSize.ToString(), _drawFont, _drawBrush,
                                    new Point((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2));
            }

            if (verticalHorizontal == VH.Horizontal)
            {
                graphics.DrawString("Horizontal", _drawFont, _drawBrush,
                                    new Point((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2 - 30));
            }

            if (verticalHorizontal == VH.Vertical)
            {
                graphics.DrawString("Vertical", _drawFont, _drawBrush,
                                    new Point((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2 - 30));
            }
        }