//Excute RPC from server public static void ExcuteRPC(uint viewID, string methodname, params NGAny[] parameters) { NGViewContainer container = new NGViewContainer(); NGView view = container.GetViewByID(viewID); List <Component> components = view.ViewComponents; foreach (var item in components) { SType type = item.GetType(); BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly; MethodInfo[] methods = type.GetMethods(flags); foreach (var method in methods) { if (method.Name.Equals(methodname)) { method.Invoke(item, new object[1] { parameters }); return; } } } // SType type = view.GetType(); // BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly; // MethodInfo[] methods = type.GetMethods(flags); // foreach (var method in methods) // { // if (method.Name.Equals(methodname)) // { // method.Invoke(null, parameters); // break; // } // } }
void Awake() { mMat = GetComponent <Renderer>().material; view = this.gameObject.GetComponent <NGView>(); }