當前位置: 首頁>>代碼示例>>C#>>正文


C# StorySystem.StoryInstance類代碼示例

本文整理匯總了C#中StorySystem.StoryInstance的典型用法代碼示例。如果您正苦於以下問題:C# StoryInstance類的具體用法?C# StoryInstance怎麽用?C# StoryInstance使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StoryInstance類屬於StorySystem命名空間,在下文中一共展示了StoryInstance類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Evaluate

 protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
 {
     m_ObjPath.Evaluate(instance, iterator, args);
     m_ComponentType.Evaluate(instance, iterator, args);
     if (m_HaveObj) {
         m_ObjVarName.Evaluate(instance, iterator, args);
     }
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:8,代碼來源:GeneralCommands.cs

示例2: Evaluate

 protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
 {
     m_MsgId.Evaluate(instance, iterator, args);
     for (int i = 0; i < m_MsgArgs.Count; ++i) {
         IStoryValue<object> val = m_MsgArgs[i];
         val.Evaluate(instance, iterator, args);
     }
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:8,代碼來源:GeneralCommands.cs

示例3: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     int objId = m_ObjId.Value;
     string value = m_Value.Value;
     EntityInfo charObj = ClientModule.Instance.GetEntityById(objId);
     if (null != charObj) {
         charObj.IsControlByStory = (0 == value.CompareTo("true"));
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:10,代碼來源:ObjectCommands.cs

示例4: Evaluate

 protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
 {
     m_Pos.Evaluate(instance, iterator, args);
     m_Radius.Evaluate(instance, iterator, args);
     m_Type.Evaluate(instance, iterator, args);
     m_EventName.Evaluate(instance, iterator, args);
     if (m_HaveSet) {
         m_SetVar.Evaluate(instance, iterator, args);
         m_SetVal.Evaluate(instance, iterator, args);
         m_ElseSetVal.Evaluate(instance, iterator, args);
     }
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:12,代碼來源:GameLogicCommands.cs

示例5: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     Scene scene = instance.Context as Scene;
     if (null != scene) {
         int objId = m_ObjId.Value;
         string value = m_Value.Value;
         EntityInfo charObj = scene.SceneContext.GetEntityById(objId);
         if (null != charObj) {
             charObj.IsControlByStory = (0 == value.CompareTo("true"));
         }
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:13,代碼來源:ObjectCommands.cs

示例6: Execute

 public bool Execute(StoryInstance instance, long delta, object iterator, object[] args)
 {
     if (IsCompositeCommand) {
         return ExecCommand(instance, delta, iterator, args);
     } else {
         if (!m_LastExecResult) {
             //重複執行時不需要每個tick都更新變量值,每個命令每次執行,變量值隻讀取一次。
             Evaluate(instance, iterator, args);
         }
         m_LastExecResult = ExecCommand(instance, delta);
         return m_LastExecResult;
     }
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:13,代碼來源:IStoryCommand.cs

示例7: ExecCommand

        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            Scene scene = instance.Context as Scene;
            if (null != scene) {
                int objId = 0;
                if (m_ParamNum >= 5) {
                    Vector3 pos = m_Pos.Value;
                    float dir = m_Dir.Value;
                    int camp = m_Camp.Value;
                    int linkId = m_LinkId.Value;
                    objId = scene.CreateEntity(m_UnitId.Value, pos.X, pos.Y, pos.Z, dir, camp, linkId);
                    if (m_ParamNum > 6) {
                        int aiLogic = m_AiLogic.Value;

                        EntityInfo charObj = scene.SceneContext.GetEntityById(objId);
                        if (null != charObj) {
                            charObj.GetAiStateInfo().Reset();
                            charObj.GetAiStateInfo().AiLogic = aiLogic;
                            if (m_ParamNum > 7) {
                                int leaderId = m_LeaderId.Value;
                                charObj.GetAiStateInfo().LeaderID = leaderId;
                            } else {
                                charObj.GetAiStateInfo().LeaderID = 0;
                            }
                            IEnumerable aiParams = m_AiParams.Value;
                            int ix = 0;
                            foreach (string aiParam in aiParams) {
                                if (ix < AiStateInfo.c_MaxAiParamNum) {
                                    charObj.GetAiStateInfo().AiParam[ix] = aiParam;
                                    ++ix;
                                } else {
                                    break;
                                }
                            }
                        }
                    }
                    EntityInfo obj = scene.GetEntityById(objId);
                    if (null != obj) {
                        Msg_RC_CreateNpc msg = DataSyncUtility.BuildCreateNpcMessage(obj);
                        scene.NotifyAllUser(RoomMessageDefine.Msg_RC_CreateNpc, msg);
                    }
                }
                if (m_HaveObjId) {
                    string varName = m_ObjIdVarName.Value;
                    instance.SetVariable(varName, objId);
                }
            }
            return false;
        }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:49,代碼來源:NpcCommands.cs

示例8: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     UserThread userThread = instance.Context as UserThread;
     if (null != userThread) {
         string msgId = m_MsgId.Value;
         ArrayList arglist = new ArrayList();
         for (int i = 0; i < m_MsgArgs.Count; ++i) {
             IStoryValue<object> val = m_MsgArgs[i];
             arglist.Add(val.Value);
         }
         object[] args = arglist.ToArray();
         userThread.StorySystem.SendMessage(msgId, args);
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:15,代碼來源:GeneralCommands.cs

示例9: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     bool triggered = false;
     string name = m_Name.Value;
     float radius = m_Radius.Value;
     string type = m_Type.Value;
     string eventName = m_EventName.Value;
     UnityEngine.GameObject obj = UnityEngine.GameObject.Find(name);
     if (null != obj) {
         UnityEngine.Vector3 pos = obj.transform.position;
         if (type == "myself") {
             EntityViewModel view = EntityController.Instance.GetEntityViewById(ClientModule.Instance.LeaderID);
             if (null != view && null != view.Actor) {
                 if ((view.Actor.transform.position - pos).sqrMagnitude < radius * radius) {
                     GfxStorySystem.Instance.SendMessage(eventName, name, radius, type);
                     triggered = true;
                 }
             }
         } else if (type == "anyenemy" || type == "anyfriend") {
             EntityInfo myself = ClientModule.Instance.GetEntityById(ClientModule.Instance.LeaderID);
             ClientModule.Instance.KdTree.Query(pos.x, pos.y, pos.z, radius, (float distSqr, KdTreeObject kdObj) => {
                 if (type == "anyenemy" && EntityInfo.GetRelation(myself, kdObj.Object) == CharacterRelation.RELATION_ENEMY ||
                     type == "anyfriend" && EntityInfo.GetRelation(myself, kdObj.Object) == CharacterRelation.RELATION_FRIEND) {
                     GfxStorySystem.Instance.SendMessage(eventName, name, radius, type);
                     triggered = true;
                     return false;
                 }
                 return true;
             });
         }
     }
     string varName = m_SetVar.Value;
     object varVal = m_SetVal.Value;
     object elseVal = m_ElseSetVal.Value;
     if (triggered) {
         instance.SetVariable(varName, varVal);
     } else {
         instance.SetVariable(varName, elseVal);
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:41,代碼來源:GameLogicCommands.cs

示例10: Evaluate

        protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
        {
            if (m_ParamNum >= 5) {
                m_UnitId.Evaluate(instance, iterator, args);
                m_Pos.Evaluate(instance, iterator, args);
                m_Dir.Evaluate(instance, iterator, args);
                m_Camp.Evaluate(instance, iterator, args);
                m_LinkId.Evaluate(instance, iterator, args);

                if (m_ParamNum > 6) {
                    m_AiLogic.Evaluate(instance, iterator, args);
                    m_AiParams.Evaluate(instance, iterator, args);
                    if (m_ParamNum > 7) {
                        m_LeaderId.Evaluate(instance, iterator, args);
                    }
                }
            }
            if (m_HaveObjId) {
                m_ObjIdVarName.Evaluate(instance, iterator, args);
            }
        }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:21,代碼來源:NpcCommands.cs

示例11: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     UserThread userThread = instance.Context as UserThread;
     if (null != userThread) {
         string key = m_Key.Value;
         object val = m_Value.Value;
         if (val is int) {
             int v = (int)val;
             GlobalData.Instance.AddInt(key, v);
         } else if (val is float) {
             float v = (float)val;
             GlobalData.Instance.AddFloat(key, v);
         } else {
             string v = val as string;
             if (null == v)
                 v = string.Empty;
             GlobalData.Instance.AddStr(key, v);
         }
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:21,代碼來源:GameLogicCommands.cs

示例12: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     Scene scene = instance.Context as Scene;
     if (null != scene) {
         bool triggered = false;
         Vector3 pos = m_Pos.Value;
         float radius = m_Radius.Value;
         string type = m_Type.Value;
         string eventName = m_EventName.Value;
         if (type == "user") {
             scene.KdTree.Query(pos, radius, (float distSqr, KdTreeObject kdObj) => {
                 if (kdObj.Object.EntityType != (int)EntityTypeEnum.Hero) {
                     scene.StorySystem.SendMessage(eventName, pos, radius, type);
                     triggered = true;
                     return false;
                 }
                 return true;
             });
         } else if (type == "npc") {
             scene.KdTree.Query(pos, radius, (float distSqr, KdTreeObject kdObj) => {
                 if (kdObj.Object.EntityType != (int)EntityTypeEnum.Hero) {
                     scene.StorySystem.SendMessage(eventName, pos, radius, type);
                     triggered = true;
                     return false;
                 }
                 return true;
             });
         }
         string varName = m_SetVar.Value;
         object varVal = m_SetVal.Value;
         object elseVal = m_ElseSetVal.Value;
         if (triggered) {
             instance.SetVariable(varName, varVal);
         } else {
             instance.SetVariable(varName, elseVal);
         }
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:39,代碼來源:GameLogicCommands.cs

示例13: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     string objPath = m_ObjPath.Value;
     object componentType = m_ComponentType.Value;
     UnityEngine.GameObject obj = UnityEngine.GameObject.Find(objPath);
     if (null != obj) {
         UnityEngine.Component component = null;
         Type t = componentType as Type;
         if (null != t) {
             component = obj.AddComponent(t);
         } else {
             string name = componentType as string;
             if (null != name) {
                 t = Type.GetType(name);
                 component = obj.AddComponent(t);
             }
         }
         if (m_HaveObj) {
             string varName = m_ObjVarName.Value;
             instance.SetVariable(varName, component);
         }
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:24,代碼來源:GeneralCommands.cs

示例14: ExecCommand

 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     Scene scene = instance.Context as Scene;
     if (null != scene) {
         int sceneId = m_TargetSceneId.Value;
         object idObj = m_ObjId.Value;
         if (idObj is int) {
             int objId = (int)idObj;
             EntityInfo entity = scene.GetEntityById(objId);
             if (null != entity) {
                 User us = entity.CustomData as User;
                 if (null != us) {
                     RoomServer.RoomServer.Instance.PlayerRequestActiveRoom(sceneId, us.Guid);
                 }
             }
         } else {
             IList<int> list = idObj as IList<int>;
             if (null != list) {
                 List<ulong> guids = new List<ulong>();
                 for (int i = 0; i < list.Count; ++i) {
                     EntityInfo entity = scene.GetEntityById(list[i]);
                     if (null != entity) {
                         User us = entity.CustomData as User;
                         if (null != us) {
                             guids.Add(us.Guid);
                         }
                     }
                 }
                 if (guids.Count > 0) {
                     RoomServer.RoomServer.Instance.PlayerRequestActiveRoom(sceneId, guids.ToArray());
                 }
             }
         }
     }
     return false;
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:36,代碼來源:GeneralCommands.cs

示例15: Evaluate

 protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
 {
     m_Key.Evaluate(instance, iterator, args);
     m_Type.Evaluate(instance, iterator, args);
 }
開發者ID:dreamanlan,項目名稱:CSharpGameFramework,代碼行數:5,代碼來源:GameLogicCommands.cs


注:本文中的StorySystem.StoryInstance類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。