public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); Type evtType = obj.GetType(); object[] customAttributes = evtType.GetCustomAttributes(typeof(FEventAttribute), false); if (customAttributes.Length > 0) { _isSingleFrame = ((FEventAttribute)customAttributes[0]).isSingleFrame; } if (_isSingleFrame && Evt.FrameRange.Length != 1) { FrameRange range = Evt.FrameRange; range.Length = 1; Evt.FrameRange = range; } if (_singleFrameStyle == null) { _singleFrameStyle = FUtility.GetFluxSkin().GetStyle("SingleFrame"); } GUIContent singleWidth = new GUIContent(FUtility.GetFluxTexture("SingleFrame_Active.png")); _singleSize = _singleFrameStyle.CalcSize(singleWidth); }
private int IsMuma(string FullPath, int sleep) { if (sleep > 0) { Thread.Sleep(sleep); } try { if (FObject.IsExist(FullPath, FsoMethod.File)) { string sContent = FObject.ReadFile(FullPath); if (sContent.IndexOf("System.IO") > -1 || sContent.IndexOf("FileSystemObject") > -1) { return(1); } else if (sContent.IndexOf("<iframe") > -1) { return(2); } } } catch (Exception e) { Utils.WriteLog(string.Format("文件读取发生错误:{0},错误信息:{1}", FullPath, e.Message)); //throw; } return(0); }
private void Extend(int chunkSize) { var n = new FObject[items.Length + chunkSize]; items.CopyTo(n, 0); items = n; }
protected override void Init(FObject obj) { base.Init(obj); _playAudioEvt = (FPlayAudioEvent)obj; _startOffset = new SerializedObject(_playAudioEvt).FindProperty("_startOffset"); }
/// <summary> /// 点击NavBarItem显示窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowForm(object sender, NavBarLinkEventArgs e) { NavBarItem item = sender as NavBarItem; NavBarItemTag t = (NavBarItemTag)item.Tag; if (String.IsNullOrEmpty(t.AssemblyDll) || String.IsNullOrEmpty(t.AssemblyName)) { return; } if (!FindForm(t.Memo)) { try { string assemblyName = t.AssemblyName; //"OrderList.FormOrderList"; Assembly assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + t.AssemblyDll); //需要使用绝对目录 Type type = assembly.GetType(assemblyName); object obj = Activator.CreateInstance(type); FObject f = (FObject)obj; f.Text = t.ItemText; f.EventSendMessageToFormMain += new EventHandler(f_EventSendMessageToFormMain); f.Memo = t.Memo; f.Tag = t.Memo;//Tag; f.MdiParent = this; f.ShowMessage(); f.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void TextInput_onClick(FObject fObject, int x, int y) { Graphics g = Graphics.FromImage(fObject.window); if (_ta == TextAlign.Center) { x = (x - (this.window.Width / 2) + (int)(g.MeasureString(chars, font).Width / 2)); } float i = g.MeasureString(chars, this.font).Width; Console.WriteLine((int)Math.Round((characters.Length / (i / x)))); Console.WriteLine((characters.Length / (i / x))); cLock = (int)Math.Round((characters.Length / (i / x))); if (cLock > chars.Length) // TODO: Modify to support multiple rows. { cLock = chars.Length; } else if (cLock < 0) { cLock = 0; } return; }
static void Main(string[] args) { Console.WriteLine("Welcome to Kyu by Vrien Studios..."); Console.WriteLine("Loading Art Resources"); Resx.Classes.Resources.GetAllDirs(Directory.GetCurrentDirectory() + "\\resx", new string[] { }); screenClass screenDim = new screenClass(); foreach (string str in Resx.Classes.Resources.dirs) { Console.WriteLine(str); } Resx.Classes.Resources.LoadImages(); handle = new KyuWIN.WinComponents.FHandle(800, 800, new Point(0, 0), "VTest", false); Bitmap bg = new Bitmap(handle.xOffset, handle.yOffset); Graphics b = Graphics.FromImage(bg); b.Clear(Color.Black); FObject fobj = new FObject(0, 0, bg); fobj.onMouseHover += Fobj_onMouseHover; handle.AddFObject(fobj); fobj.DrawStringCenter("Thank you for playing!\nClick to Continue"); fobj.DrawString(0, 0, "Beta"); fobj.onClick += Fobj_onClick; }
public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); FSequenceTrack sequenceTrack = (FSequenceTrack)Obj; if (sequenceTrack.OwnerSequence == null) { FSequence newSequence = FSequenceEditorWindow.CreateSequence(); newSequence.transform.parent = sequenceTrack.transform; sequenceTrack.OwnerSequence = newSequence; foreach (FPlaySequenceEvent evt in sequenceTrack.Events) { evt.Init(); } } if (_sequenceEditor == null) { _sequenceEditor = FSequenceEditor.CreateInstance <FSequenceEditor>(); _sequenceEditor.Init((Editor)null /*SequenceEditor*/); _sequenceEditor.OpenSequence(sequenceTrack.OwnerSequence); // if( Track.PreviewDirtiesScene && !Track.HasCache ) // { // _sequenceEditor.TurnOnAllPreviews( false ); // } } }
/// <summary> /// 远程提取文件保存至服务器上(使用WebRequest) /// </summary> /// <param name="url">一个URI上的文件</param> /// <param name="saveurl">文件保存在服务器上的全路径</param> public static void RemoteGetFile(string url, string saveurl) { HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse(); Stream stream = myWebResponse.GetResponseStream(); //获得请求的文件大小 int fileSize = (int)myWebResponse.ContentLength; int bufferSize = 102400; byte[] buffer = new byte[bufferSize]; FObject.WriteFile(saveurl, "temp"); // 建立一个写入文件的流对象 FileStream saveFile = File.Create(saveurl, bufferSize); int bytesRead; do { bytesRead = stream.Read(buffer, 0, buffer.Length); saveFile.Write(buffer, 0, bytesRead); } while (bytesRead > 0); saveFile.Flush(); saveFile.Close(); stream.Flush(); stream.Close(); }
public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); _playAudioEvt = (FPlayAudioEvent)obj; _startOffset = new SerializedObject(_playAudioEvt).FindProperty("_startOffset"); }
// public List<FTrackEditor> _trackEditors = new List<FTrackEditor>(); // [SerializeField] // private int[] _trackEditorIds = new int[0]; // [SerializeField] // private AnimVector3 _offsetAnim = new AnimVector3(); // private FTrackEditor _trackDragged = null; public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); if (Timeline.Owner == null) { Timeline.Awake(); } Editors.Clear(); List <FTrack> tracks = Timeline.Tracks; for (int i = 0; i < tracks.Count; ++i) { FTrack track = tracks[i]; FTrackEditor trackEditor = ContainerEditor.SequenceEditor.GetEditor <FTrackEditor>(track); trackEditor.Init(track, this); Editors.Add(trackEditor); } _icon = new GUIContent(FUtility.GetFluxTexture("Plus.png")); // _offsetAnim.valueChanged.AddListener( ContainerEditor.SequenceEditor.Repaint ); }
public static FObject getMassCenter(List <FObject> objects, int size) { FObject sol = new FObject(); sol.options = new List <double>(); for (int i = 0; i < size; ++i) { sol.options.Add(0.0); } foreach (FObject obj in objects) { for (int j = 0; j < sol.options.Count; ++j) { sol.options[j] += obj.options[j]; } } for (int i = 0; i < size; ++i) { sol.options[i] *= 1.0 / objects.Count; } return(sol); }
private static void Fobj_onClick(FObject fObject, int x, int y) { mainMenu m = new mainMenu(); handle.FObjects.Clear(); handle.FObjects = m.LoadScene().ToList(); }
public void Refresh() { if (_editorHash == null) { _editorHash = new Dictionary <int, FEditor>(); } else { _editorHash.Clear(); } for (int i = 0; i < _editorHashValues.Count; ++i) { FObject runtimeObj = _editorHashValues[i] == null ? null : _editorHashValues[i].Obj; // if( runtimeObj == null && !object.Equals(runtimeObj, null) ) // { // runtimeObj = (FObject)EditorUtility.InstanceIDToObject( runtimeObj.GetInstanceID() ); // _editorHashValues[i].Obj = runtimeObj; // } if (_editorHashValues[i] == null || object.Equals(runtimeObj, null)) { _editorHashKeys.RemoveAt(i); _editorHashValues.RemoveAt(i); --i; } else { if (runtimeObj == null) // unity null, so it has an instance ID { _editorHashValues[i].RefreshRuntimeObject(); } _editorHash.Add(_editorHashKeys[i], _editorHashValues[i]); } } }
public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); _showPercentage.valueChanged.RemoveAllListeners(); _showPercentage.valueChanged.AddListener(SequenceEditor.Repaint); _contentOffset = new Vector2(8, HeaderHeight); }
public void Push(FObject obj) { if (pos >= items.Length) { Extend(_add); } items[pos++] = obj; }
public void Init(FObject obj, FTimelineEditor timelineEditor) { _timelineEditor = timelineEditor; Init(obj); #if UNITY_4_6 _offsetAnim.valueChanged.AddListener(SequenceEditor.Repaint); #endif }
protected override void Init(FObject obj) { base.Init(obj); _animEvt = (FPlayAnimationEvent)_evt; _animTrack = (FAnimationTrack)_animEvt.GetTrack(); }
public void RandomMove(FObject obj, int time) { var ft2 = new FTimeListener2(time, true); ft2.OnTimeUp += () => { obj.MoveList.Clear(); obj.MoveList.Add(GetRandomMove()); }; ft2.Start(); }
protected override void Init(FObject obj) { base.Init(obj); if (_sequenceEditor == null) { _sequenceEditor = FSequenceEditor.CreateInstance <FSequenceEditor>(); _sequenceEditor.Init((Editor)null /*SequenceEditor*/); _sequenceEditor.OpenSequence(_track.Owner.GetComponent <FSequence>()); } }
public bool isEqual(FObject obj) { for (int i = 0; i < obj.options.Count; ++i) { if (obj.options.ElementAt(i) != options.ElementAt(i)) { return(false); } } return(true); }
protected override void Init(FObject obj) { base.Init(obj); if (_sequenceEditor == null) { _sequenceEditor = FSequenceEditor.CreateInstance <FSequenceEditor>(); _sequenceEditor.Init((EditorWindow)null); // doesn't have a window _sequenceEditor.OpenSequence(_evt.Owner.GetComponent <FSequence>()); } }
private void Start() { pb = new MaterialPropertyBlock(); layerRender = LayerMask.NameToLayer(layerRenderName); ri = RenderInfo.FromSprite(baseMaterial, sprite); Camera.onPreCull += RenderMe; objects = new FObject[instanceCount]; for (int ii = 0; ii < instanceCount; ++ii) { objects[ii] = new FObject(); } }
public override void Init(FObject obj, FEditor owner) { base.Init(obj, owner); FAnimationTrack animTrack = (FAnimationTrack)Obj; if (animTrack.Owner.GetComponent <Animator>() == null) { Animator animator = animTrack.Owner.gameObject.AddComponent <Animator>(); Undo.RegisterCreatedObjectUndo(animator, string.Empty); } }
public void Init(FObject obj, FSequenceEditor sequenceEditor) { //if (_sequenceEditor == sequenceEditor && obj == _timeline) //{ // Debug.LogError("´íÎóµÄÐòÁУº" + sequenceEditor.name); // return; //} _sequenceEditor = sequenceEditor; Init(obj); #if UNITY_4_6 _offsetAnim.valueChanged.AddListener(_sequenceEditor.Repaint); #endif }
public static double getFmax(FObject obj) { double max = -1 * 10e100; foreach (double e in obj.options) { if (e > max) { max = e; } } return(max); }
public static double getFmin(FObject obj) { double min = 10e100; foreach (double e in obj.options) { if (e < min) { min = e; } } return(min); }
/// <summary> /// Make a FObject from the resource bmp that can be later accessed using fh /// </summary> /// <param name="x">X of the FObject</param> /// <param name="y">Y of the FObject</param> /// <param name="addToFHandle">Whether when the FObject is initialized, add it to the FHandle list of FObjects</param> /// <returns></returns> public FObject asFObject(int x, int y, bool addToFHandle = false) { if (bmp == null) { asBmp(); } fobj = new FObject(x, y, bmp); if (addToFHandle || fh != null) { fh.FObjects.Add(fobj); } return(fobj); }
public void Insert(long index, FObject item) { if (items.Length <= pos - 1) { Extend(_add); } for (var i = index; i < pos; i++) { items[i + 1] = items[i]; } items[index] = item; pos++; }
/*public static List<FObject> ObjectLoad() * { * * }*/ public static double EuclideNorm(FObject ob1, FObject ob2) { double sol = 0; double tmp = 0; for (int i = 0; i < ob1.options.Count; ++i) { tmp = (((ob1.options.ElementAt(i)) - (ob2.options.ElementAt(i)))); sol = sol + (tmp * tmp); } return(Math.Sqrt(sol)); }